src/jdk.incubator.adba/share/classes/jdk/incubator/sql2/Session.java
branchJDK-8188051-branch
changeset 56828 64304e37e9b1
parent 56824 62e92191354d
child 56832 4f7713e6a308
equal deleted inserted replaced
56827:1a36ad36c9e9 56828:64304e37e9b1
   453    * @throws IllegalStateException if this Session is not active
   453    * @throws IllegalStateException if this Session is not active
   454    */
   454    */
   455   public <S, T> OperationGroup<S, T> operationGroup();
   455   public <S, T> OperationGroup<S, T> operationGroup();
   456 
   456 
   457   /**
   457   /**
   458    * Returns a new {@link TransactionEnd} that can be used as an argument to an
   458    * Returns a new {@link TransactionCompletion} that can be used as an argument to an
   459    * endTransaction Operation.
   459    * endTransaction Operation.
   460    *
   460    *
   461    * It is most likely an error to call this within an error handler, or any
   461    * It is most likely an error to call this within an error handler, or any
   462    * handler as it is very likely that when the handler is executed the next
   462    * handler as it is very likely that when the handler is executed the next
   463    * submitted endTransaction {@link Operation} will have been created with a 
   463    * submitted endTransaction {@link Operation} will have been created with a 
   464    * different TransactionEnd.
   464  different TransactionCompletion.
   465  
   465  
   466  ISSUE: Should this be moved to OperationGroup?
   466  ISSUE: Should this be moved to OperationGroup?
   467    *
   467    *
   468    * @return a new {@link TransactionEnd}. Not null.
   468    * @return a new {@link TransactionCompletion}. Not null.
   469    * @throws IllegalStateException if this Session is not active
   469    * @throws IllegalStateException if this Session is not active
   470    */
   470    */
   471   public TransactionEnd transactionEnd();
   471   public TransactionCompletion transactionCompletion();
   472   
   472   
   473   /**
   473   /**
   474    * Unconditionally perform a transaction rollback. Create an endTransaction 
   474    * Unconditionally perform a transaction rollback. Create an endTransaction 
   475    * {@link Operation}, set it to rollback only, and submit it. The endTransaction
   475    * {@link Operation}, set it to rollback only, and submit it. The endTransaction
   476    * is never skipped. Convenience method. To execute a commit call 
   476    * is never skipped. Convenience method. To execute a commit call 
   477    * {@link OperationGroup#commitMaybeRollback(jdk.incubator.sql2.TransactionEnd)}.
   477    * {@link OperationGroup#commitMaybeRollback(jdk.incubator.sql2.TransactionCompletion)}.
   478    *
   478    *
   479    * @return this {@link OperationGroup}
   479    * @return this {@link OperationGroup}
   480    * @see OperationGroup#commitMaybeRollback(jdk.incubator.sql2.TransactionEnd) 
   480    * @see OperationGroup#commitMaybeRollback(jdk.incubator.sql2.TransactionCompletion) 
   481    */
   481    */
   482   public default CompletionStage<TransactionOutcome> rollback() {
   482   public default CompletionStage<TransactionOutcome> rollback() {
   483     TransactionEnd t = transactionEnd();
   483     TransactionCompletion t = transactionCompletion();
   484     t.setRollbackOnly();
   484     t.setRollbackOnly();
   485     catchErrors();
   485     catchErrors();
   486     return this.endTransactionOperation(t).submit().getCompletionStage();
   486     return this.endTransactionOperation(t).submit().getCompletionStage();
   487   }
   487   }
   488 
   488