T
- The type of the result of the Operation
that created this
Submission
public interface Submission<T>
Operation
. The cancel()
method of a
CompletionStage
does not cancel the Operation
. This is part
of the contract of CompletionStage
. This type provides a method to
cancel the Operation
. Canceling an Operation
only makes sense
after the Operation
is submitted so this type is the result of
submitting an Operation
.
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.Modifier and Type | Method | Description |
---|---|---|
java.util.concurrent.CompletionStage<java.lang.Boolean> |
cancel() |
Request that the
Operation not be executed or that its execution be
aborted if already begun. |
java.util.concurrent.CompletionStage<T> |
getCompletionStage() |
Returns a
CompletionStage which value is the result of the
Operation . |
java.util.concurrent.CompletionStage<java.lang.Boolean> cancel()
Operation
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.CompletionStage
that has the value
true if the Operation
is canceled.java.util.concurrent.CompletionStage<T> getCompletionStage()
CompletionStage
which value is the result of the
Operation
. Any actions on the returned CompletionStage
,
eg completeExceptionally
or cancel
, have no impact on this
Operation
. If this Operation
is already completed the
returned CompletionStage
will be completed.
The returned CompletionStage
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 given Operation
returns the same
CompletionStage
.CompletionStage
for the result of this
Operation
. Retained.Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
DRAFT JDBC 4.4 EA5