Class CancellationTokenSource

  • All Implemented Interfaces:

    
    public final class CancellationTokenSource
    
                        

    Propagates notification that operations should be canceled.

    Create an instance of CancellationTokenSource and pass the token returned from token to the asynchronous operation(s). Call cancel to cancel the operations.

    A CancellationToken can only be cancelled once - it should not be passed to future operations once cancelled.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final CancellationToken getToken()
      final Unit cancel() Cancels the runnable if it has not already been cancelled.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CancellationTokenSource

        CancellationTokenSource()