jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.overlap
Interface AsyncResult<T>

Type Parameters:
T - Type of the supplied calculations result

public interface AsyncResult<T>

Result handler for long running asynchronous calculations where partial return values are provided. Note that this interface is currently not used.

Some long running calculations can provide meaningful, approximate intermediate results. Such long running, possibly multithreaded (or even distributed) task results can be represented with a ListenableFuture. When intermediate results are also required, ListenableFuture instances can provide a meaningful representation for them.

To access the results of the calculation use getResult() which returns the same reference for each invocation.

Author:
Gabor Imre

Method Summary
 ListenableFuture<T> createIntermediateResult()
          Create a new intermediate result.
 ListenableFuture<T> getResult()
          Get the representation of the long running task.
 

Method Detail

getResult

ListenableFuture<T> getResult()
Get the representation of the long running task.

This is the final result of the represented task. The returned ListenableFuture is allocated when this AsyncResult is created; the same reference is returned on every invocation.

Cancellation by invoking Future.cancel(boolean) on the returned reference cancels the underlying calculations and intermediate results returned by subsequent createIntermediateResult() calls. Non completed intermediate results might or might not be cancelled. Cancel also can propagate from ProgressObserver passed when the given long running task started. Cancellation of partial results never propagates to the final result.

Returns:
Representation of the long running task

createIntermediateResult

ListenableFuture<T> createIntermediateResult()
Create a new intermediate result.

The semantics of the intermediate results varies between implementations. An intermediate result can provide the same result as the final one returned by getResult(), the same time, however usually a new, lighter asynchronous task is needed to collect the intermediate results. Note that the reference returned by this call is always a new instance in order to mitigate cancel propagation.

Cancellation of intermediate results returned by this method never propagates to other intermediate results returned by preceding or subsequent calls to this method, nor to the final result returned by getResult(). Cancellation of the final result or the ProgressObserver observing the execution might or might not propagate to intermediate results requested earlier.

Returns:
An intermediate result of the represented task.

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)