public interface

CancelState

com.atlassian.bitbucket.util.CancelState
Known Indirect Subclasses

Class Overview

Tracks the cancelation state of a cancelable operation.

Once an operation has been canceled, it cannot be "un-canceled". Where multiple observers have the option to cancel an operation, cancellation by any observer should be considered as final and binding; implementations should not require consensus among all observers.

Summary

Public Methods
void cancel(KeyedMessage message)
Cancels the operation, providing a message explaining why.
boolean isCanceled()
Retrieves a flag indicating whether the operation has been canceled.

Public Methods

public void cancel (KeyedMessage message)

Cancels the operation, providing a message explaining why.

The cancellation message is required, and should be as descriptive and clear as possible to allow end users to correct, if possible, the issue that triggered cancellation.

Parameters
message a descriptive message explaining why the operation has been canceled
Throws
NullPointerException if the provided message is null

public boolean isCanceled ()

Retrieves a flag indicating whether the operation has been canceled.

In situations where multiple observers have the option to cancel an operation, for example when multiple listeners receive the same CancelableEvent, this flag can be useful for determining that another observer has already canceled the operation.

Returns
  • true if the operation has been canceled; otherwise, false