Interface Submission<T>

  • Type Parameters:
    T - The type of the result of the Operation that created this Submission

    public interface Submission<T>
    The result of submitting an 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.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      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.
    • Method Detail

      • cancel

        java.util.concurrent.CompletionStage<java.lang.Boolean> cancel()
        Request that the 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.
        Returns:
        a CompletionStage that has the value true if the Operation is canceled.
      • getCompletionStage

        java.util.concurrent.CompletionStage<T> getCompletionStage()
        Returns a 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.
        Returns:
        the CompletionStage for the result of this Operation. Retained.