-
- Type Parameters:
T
- The type of the result of theOperation
that created thisSubmission
public interface Submission<T>
The result of submitting anOperation
. Thecancel()
method of aCompletionStage
does not cancel theOperation
. This is part of the contract ofCompletionStage
. This type provides a method to cancel theOperation
. Canceling anOperation
only makes sense after theOperation
is submitted so this type is the result of submitting anOperation
. ISSUE: Should Operation.submit return a CompletionStage with the requirement that cancel attempts to cancel the database action? Conceptually this is fine. The concern is that it requires the implementor to implement their own CompletionStage or at the least subclass CompletableFuture to override cancel. Neither of these is trivial.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletionStage<java.lang.Boolean>
cancel()
Request that theOperation
not be executed or that its execution be aborted if already begun.java.util.concurrent.CompletionStage<T>
getCompletionStage()
Returns aCompletionStage
which value is the result of theOperation
.
-
-
-
Method Detail
-
cancel
java.util.concurrent.CompletionStage<java.lang.Boolean> cancel()
Request that theOperation
not be executed or that its execution be aborted if already begun. This is a best effort action and may not succeed in preventing or aborting the execution. This method does not block. If execution is prevented the Operation is completed exceptionally with SkippedSqlException. If the Operation is aborted it is completed exceptionally with SqlException.- Returns:
- a
CompletionStage
that has the value true if theOperation
is canceled.
-
getCompletionStage
java.util.concurrent.CompletionStage<T> getCompletionStage()
Returns aCompletionStage
which value is the result of theOperation
. Any actions on the returnedCompletionStage
, egcompleteExceptionally
orcancel
, have no impact on thisOperation
. If thisOperation
is already completed the returnedCompletionStage
will be completed. The returnedCompletionStage
is completed after the Operation is completed. It may be completed by the same thread that completed the Operation or a different one. The Operation following the one that created this Submission begins execution when the Operation that created this Submission is completed. It is not required to wait for the returned CompletionStage to complete. [Note: this is necessary because the app can call this method after the Operation completes.] Each call of this method for a givenOperation
returns the sameCompletionStage
.- Returns:
- the
CompletionStage
for the result of thisOperation
. Retained.
-
-