Android SDK Version
All Implemented Interfaces:
java.io.Closeable , java.lang.AutoCloseable


public final class CancellationTokenSource
 implements Closeable
Signals to a CancellationToken that it should be canceled. To create a CancellationToken first create a CancellationTokenSource then use token to retrieve the token for the source.
Field Summary
Modifier and TypeFieldDescription
private final BooleanisCancellationRequested
private final CancellationTokentoken
Constructor Summary
ConstructorDescription
CancellationTokenSource()
Method Summary
Modifier and TypeMethodDescription
final BooleangetIsCancellationRequested()
final CancellationTokengetToken()
final Unitcancel() Cancels the token if it has not already been cancelled.
final UnitcancelAfter(Long delay) Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.
Unitclose()
StringtoString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

CancellationTokenSource

CancellationTokenSource()
Method Detail

getIsCancellationRequested

 final BooleangetIsCancellationRequested()

getToken

 final CancellationTokengetToken()

cancel

 final Unitcancel()
Cancels the token if it has not already been cancelled.

cancelAfter

 final UnitcancelAfter(Long delay)
Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.
Parameters:
delay - The number of milliseconds to wait before completing the returned task.

close

Unitclose()

toString

StringtoString()