CancellationTokenSource

Inheritance: java.lang.Object

public class CancellationTokenSource

Signals to a CancellationToken that it should be canceled.

Constructors

ConstructorDescription
CancellationTokenSource()

Methods

MethodDescription
cancel()Communicates a request for cancellation.
getToken()Creates the new CancellationToken associated with this CancellationTokenSource.
isCancellationRequested()Gets whether cancellation has been requested for this CancellationTokenSource.

CancellationTokenSource()

public CancellationTokenSource()

cancel()

public void cancel()

Communicates a request for cancellation.

getToken()

public CancellationToken getToken()

Creates the new CancellationToken associated with this CancellationTokenSource.

Returns: CancellationToken - a token associated with this CancellationTokenSource.

isCancellationRequested()

public boolean isCancellationRequested()

Gets whether cancellation has been requested for this CancellationTokenSource.

Returns: boolean - true, if cancellation has been requested; false otherwise.