java.lang.Object
com.hedera.hashgraph.sdk.CancellationState
The state a
CancellationSource and the Cancellation it hands out share.
Splitting the observer from the source is the point: a Cancellation is handed to
third-party transports, code the SDK did not write, and if cancel() lived on it a transport
could cancel the caller's own operation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcancel()Fire the cancellation.(package private) boolean(package private) CancellationRegistrationRegister an observer, running it immediately if the cancellation has already fired.(package private) void
-
Constructor Details
-
CancellationState
CancellationState()
-
-
Method Details
-
isCancelled
boolean isCancelled() -
cancel
void cancel()Fire the cancellation. Idempotent; a second call is a no-op.isCancelled()returns true before any callback runs. Callbacks run synchronously on the calling thread, and one that throws neither prevents the others from running nor propagates to the caller. -
onCancel
Register an observer, running it immediately if the cancellation has already fired. -
remove
-