Delen via


DataLakeLeaseClient.BreakAsync Method

Definition

The BreakAsync(Nullable<TimeSpan>, RequestConditions, CancellationToken) operation breaks the path or file system's previously-acquired lease (if it exists).

Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break breakPeriod is allowed to elapse, during which time no lease operation except BreakAsync(Nullable<TimeSpan>, RequestConditions, CancellationToken) and ReleaseAsync(RequestConditions, CancellationToken) can be performed on the path or file system. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired.

A lease that has been broken can also be released. A client can immediately acquire a path or file system lease that has been released.

For more information, see Lease Container.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.DataLakeLease>> BreakAsync (TimeSpan? breakPeriod = default, Azure.RequestConditions conditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member BreakAsync : Nullable<TimeSpan> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.DataLakeLease>>
override this.BreakAsync : Nullable<TimeSpan> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.DataLakeLease>>
Public Overridable Function BreakAsync (Optional breakPeriod As Nullable(Of TimeSpan) = Nothing, Optional conditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of DataLakeLease))

Parameters

breakPeriod
Nullable<TimeSpan>

Specifies the proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this value is not provided, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately.

conditions
RequestConditions

Optional RequestConditions to add conditions on acquiring a lease.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

A Response<T> describing the broken lease.

Remarks

A RequestFailedException will be thrown if a failure occurs.

Applies to