Google is committed to advancing racial equity for Black communities. See how.

CancellationTokenSource

public class CancellationTokenSource extends Object

Creates a new CancellationToken or cancels one that has already created. There is a 1:1 CancellationTokenSource to CancellationToken relationship.

To create a CancellationToken, create a CancellationTokenSource first and then call getToken() to get the CancellationToken for this CancellationTokenSource.

Public Constructor Summary

Public Method Summary

void
cancel()
Cancels the CancellationToken if cancellation has not been requested yet.
CancellationToken

Inherited Method Summary

Public Constructors

public CancellationTokenSource ()

Creates a new CancellationTokenSource instance.

Public Methods

public void cancel ()

Cancels the CancellationToken if cancellation has not been requested yet.

public CancellationToken getToken ()

Returns