A CancellationTokenSource allows you to issue cancellation requests to one or more org.gradle.tooling.LongRunningOperation instances. To use a token source:

  • Create a token source using newCancellationTokenSource.
  • Attach the token to one or more operations using withCancellationToken. You need to do this before you start the operation.
  • Later, you can cancel the associated operations by calling cancel on this token source.

All implementations of this interface are required to be thread safe.




Link copied to clipboard
abstract fun cancel()
Initiates cancel request.
Link copied to clipboard
abstract fun token(): CancellationToken
Returns a token associated with this CancellationTokenSource.