saker.build Documentation TaskDoc JavaDoc Packages
public interface InnerTaskResults<R>
Interface for providing access to the results of inner task executions.

The interface allows access to the task results by basically working like an iterator. The results can be retrieved by calling getNext(), which will wait if necessary and return non-null if there is an inner task result available. This interface works like an iterator, but doesn't have next() function, as the checking and retrieving the next result needs to be atomic in the context of multiple consumers.

The interface can hold any amount of task results. It is possible, that it never returns any inner task results.

The interface provides functionality for cancelling the duplication of the inner tasks.

RThe type of the task results.
Methods
public void
Manually cancels the duplication of the associated inner task.
public InnerTaskResultHolder<R>
Gets the results of a finished inner task.
public abstract void cancelDuplicationOptionally()
Manually cancels the duplication of the associated inner task.

This method will attempt to cancel the duplication of the started inner task. If duplication cancellation is not enabled or all the tasks have finished, this method is a no-op.

When the duplication is cancelled, all already running inner tasks will run to completion, and no more will be started via duplication.

Gets the results of a finished inner task.

This method will check if there is any unretrieved inner task result available, and if so, returns immediately. If not, then it will wait until one of the inner tasks finish. If there are no more inner tasks running, null is returned.

Once this method returns null, all further calls to it will return null.

If an inner task throws an exception, this method will not propagate it, but it is available through the returned object.

The result holder of a completed inner task or null if there are no more results.
InterruptedExceptionIf the current thread is interrupted while it is waiting for the result of a task.
InnerTaskInitializationExceptionIf the inner task failed to start on the execution environments. This exception may be thrown in a delayed manner, and not directly by TaskContext.startInnerTask(TaskFactory<R>, InnerTaskExecutionParameters).
IllegalTaskOperationExceptionIf this function is not called on the task thread.