Interface Cancellable
-
- All Known Subinterfaces:
CancellationPoint
- All Known Implementing Classes:
DefaultCancellationPoint
,DelegatingCancellationPoint
,DummyCancellationPoint
public interface Cancellable
Interface for classes supporting cancellable computation.- Since:
- 7.3
- Author:
- Pavel Klinov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancel(java.lang.String theCause)
Cancels the execution of this computation.
-
-
-
Method Detail
-
cancel
void cancel(java.lang.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, callingIterator.next()
orIterator.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 ornull
if the cause is unknown
-
-