Package com.complexible.common.cancellation

# Interface Cancellable

All Known Subinterfaces:
  `CancellationPoint`, `HandlerBackedIterator.DataProducer<T>`

All Known Implementing Classes:
  `DefaultCancellationPoint`, `DelegatingCancellationPoint`, `DummyCancellationPoint`

public interface Cancellable
Interface for classes supporting cancellable computation.

Since:
  7.3
Author:
  Pavel Klinov

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `cancel(String theCause)`
  Cancels the execution of this computation.

- ## Method Details

  - ### cancel

    void cancel(String theCause)
    Cancels the execution of this computation. It is up to the implementation to decide how to implement the cancellation process. If the underlying implementation is based on the iterator model, calling `Iterator.next()` or `Iterator.hasNext()` after this function is called will result in an exception being thrown. Some implementations might have a different strategy but the expectation for every implementation is to finish computation in a reasonable time. So implementations that always return few results without much computation might ignore cancel calls completely. If a computation is composed of other computations then cancel call will be typically propagated to the child computations since there could be significant amount of work performed by them before the parent computation returns a single value. This function is typically called from a different thread the thread that iterates over the results of this computation so implementations should consider this.
    Parameters:
      `theCause` - the cause of the cancellation or `null` if the cause is unknown