BlobLeaseClient Class

Definition

This class provides a client that contains all the leasing operations for BlobContainerClient and BlobClient. This client acts as a supplement to those clients and only handles leasing operations.

Instantiating a BlobLeaseClient

{@codesnippet com.azure.storage.blob.specialized.LeaseClientBuilder.syncInstantiationWithBlob} {@codesnippet com.azure.storage.blob.specialized.LeaseClientBuilder.syncInstantiationWithContainer}

View BlobLeaseClientBuilder for additional ways to construct the client.

For more information about leasing see the container leasing or blob leasing documentation.

public final class BlobLeaseClient
Inheritance
java.lang.Object
BlobLeaseClient

Inherited Members

java.lang.Object.clone() java.lang.Object.equals(java.lang.Object) java.lang.Object.finalize() java.lang.Object.getClass() java.lang.Object.hashCode() java.lang.Object.notify() java.lang.Object.notifyAll() java.lang.Object.toString() java.lang.Object.wait() java.lang.Object.wait(long) java.lang.Object.wait(long,int)

Methods

acquireLease(int duration)

Acquires a lease for write and delete operations. The lease duration must be between 15 to 60 seconds or -1 for an infinite duration.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.acquireLease#int}

acquireLeaseWithResponse(BlobAcquireLeaseOptions options, Duration timeout, Context context)

Acquires a lease for write and delete operations. The lease duration must be between 15 to 60 seconds or -1 for an infinite duration.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.acquireLeaseWithResponse#BlobAcquireLeaseOptions-Duration-Context}

acquireLeaseWithResponse(int duration, RequestConditions modifiedRequestConditions, Duration timeout, Context context)

Acquires a lease for write and delete operations. The lease duration must be between 15 to 60 seconds or -1 for an infinite duration.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.acquireLeaseWithResponse#int-RequestConditions-Duration-Context}

breakLease()

Breaks the previously acquired lease, if it exists.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.breakLease}

breakLeaseWithResponse(BlobBreakLeaseOptions options, Duration timeout, Context context)

Breaks the previously acquired lease, if it exists.

If null is passed for breakPeriodInSeconds a fixed duration lease will break after the remaining lease period elapses and an infinite lease will break immediately.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.breakLeaseWithResponse#BlobBreakLeaseOptions-Duration-Context}

breakLeaseWithResponse(Integer breakPeriodInSeconds, RequestConditions modifiedRequestConditions, Duration timeout, Context context)

Breaks the previously acquired lease, if it exists.

If null is passed for breakPeriodInSeconds a fixed duration lease will break after the remaining lease period elapses and an infinite lease will break immediately.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.breakLeaseWithResponse#Integer-RequestConditions-Duration-Context}

changeLease(String proposedId)

Changes the lease ID.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.changeLease#String}

changeLeaseWithResponse(BlobChangeLeaseOptions options, Duration timeout, Context context)

Changes the lease ID.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.changeLeaseWithResponse#BlobChangeLeaseOptions-Duration-Context}

changeLeaseWithResponse(String proposedId, RequestConditions modifiedRequestConditions, Duration timeout, Context context)

Changes the lease ID.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.changeLeaseWithResponse#String-RequestConditions-Duration-Context}

getAccountName()

Get associated account name.

getLeaseId()

Get the lease ID for this lease.

getResourceUrl()

Gets the URL of the lease client.

The lease will either be a container or blob URL depending on which the lease client is associated.

releaseLease()

Releases the previously acquired lease.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.releaseLease}

releaseLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout, Context context)

Releases the previously acquired lease.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.releaseLeaseWithResponse#RequestConditions-Duration-Context}

releaseLeaseWithResponse(BlobReleaseLeaseOptions options, Duration timeout, Context context)

Releases the previously acquired lease.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.releaseLeaseWithResponse#BlobReleaseLeaseOptions-Duration-Context}

renewLease()

Renews the previously acquired lease.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.renewLease}

renewLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout, Context context)

Renews the previously-acquired lease.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.renewLeaseWithResponse#RequestConditions-Duration-Context}

renewLeaseWithResponse(BlobRenewLeaseOptions options, Duration timeout, Context context)

Renews the previously-acquired lease.

Code Samples

{@codesnippet com.azure.storage.blob.specialized.BlobLeaseClient.renewLeaseWithResponse#BlobRenewLeaseOptions-Duration-Context}

Applies to