Save This Page
Home » glassfish-v2ur2-b04-src » javax » transaction » [javadoc | source]
    1   /*
    2    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    3    * 
    4    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    5    * 
    6    * The contents of this file are subject to the terms of either the GNU
    7    * General Public License Version 2 only ("GPL") or the Common Development
    8    * and Distribution License("CDDL") (collectively, the "License").  You
    9    * may not use this file except in compliance with the License. You can obtain
   10    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   11    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   12    * language governing permissions and limitations under the License.
   13    * 
   14    * When distributing the software, include this License Header Notice in each
   15    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   16    * Sun designates this particular file as subject to the "Classpath" exception
   17    * as provided by Sun in the GPL Version 2 section of the License file that
   18    * accompanied this code.  If applicable, add the following below the License
   19    * Header, with the fields enclosed by brackets [] replaced by your own
   20    * identifying information: "Portions Copyrighted [year]
   21    * [name of copyright owner]"
   22    * 
   23    * Contributor(s):
   24    * 
   25    * If you wish your version of this file to be governed by only the CDDL or
   26    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   27    * elects to include this software in this distribution under the [CDDL or GPL
   28    * Version 2] license."  If you don't indicate a single choice of license, a
   29    * recipient has the option to distribute your version of this file under
   30    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   31    * its licensees as provided above.  However, if you add GPL Version 2 code
   32    * and therefore, elected the GPL Version 2 license, then the option applies
   33    * only if the new code is made subject to such option by the copyright
   34    * holder.
   35    */
   36   
   37   package javax.transaction;
   38   
   39   import java.lang.IllegalArgumentException;
   40   import java.lang.IllegalStateException;
   41   import java.lang.SecurityException;
   42   
   43   /**
   44    * The UserTransaction interface defines the methods that allow an
   45    * application to explicitly manage transaction boundaries.
   46    */
   47   public interface UserTransaction {
   48   
   49       /**
   50        * Create a new transaction and associate it with the current thread.
   51        *
   52        * @exception NotSupportedException Thrown if the thread is already
   53        *    associated with a transaction and the Transaction Manager
   54        *    implementation does not support nested transactions.
   55        *
   56        * @exception SystemException Thrown if the transaction manager
   57        *    encounters an unexpected error condition.
   58        *
   59        */
   60       void begin() throws NotSupportedException, SystemException;
   61   
   62       /**
   63        * Complete the transaction associated with the current thread. When this
   64        * method completes, the thread is no longer associated with a transaction.
   65        *
   66        * @exception RollbackException Thrown to indicate that
   67        *    the transaction has been rolled back rather than committed.
   68        *
   69        * @exception HeuristicMixedException Thrown to indicate that a heuristic
   70        *    decision was made and that some relevant updates have been committed
   71        *    while others have been rolled back.
   72        *
   73        * @exception HeuristicRollbackException Thrown to indicate that a
   74        *    heuristic decision was made and that all relevant updates have been
   75        *    rolled back.
   76        *
   77        * @exception SecurityException Thrown to indicate that the thread is
   78        *    not allowed to commit the transaction.
   79        *
   80        * @exception IllegalStateException Thrown if the current thread is
   81        *    not associated with a transaction.
   82        *
   83        * @exception SystemException Thrown if the transaction manager
   84        *    encounters an unexpected error condition.
   85       */
   86       void commit() throws RollbackException,
   87   	HeuristicMixedException, HeuristicRollbackException, SecurityException,
   88   	IllegalStateException, SystemException;
   89   
   90       /**
   91        * Roll back the transaction associated with the current thread. When this
   92        * method completes, the thread is no longer associated with a transaction.
   93        *
   94        * @exception SecurityException Thrown to indicate that the thread is
   95        *    not allowed to roll back the transaction.
   96        *
   97        * @exception IllegalStateException Thrown if the current thread is
   98        *    not associated with a transaction.
   99        *
  100        * @exception SystemException Thrown if the transaction manager
  101        *    encounters an unexpected error condition.
  102        *
  103        */
  104       void rollback() throws IllegalStateException, SecurityException,
  105           SystemException;
  106   
  107       /**
  108        * Modify the transaction associated with the current thread such that
  109        * the only possible outcome of the transaction is to roll back the
  110        * transaction.
  111        *
  112        * @exception IllegalStateException Thrown if the current thread is
  113        *    not associated with a transaction.
  114        *
  115        * @exception SystemException Thrown if the transaction manager
  116        *    encounters an unexpected error condition.
  117        *
  118        */
  119       void setRollbackOnly() throws IllegalStateException, SystemException;
  120   
  121       /**
  122        * Obtain the status of the transaction associated with the current thread.
  123        *
  124        * @return The transaction status. If no transaction is associated with
  125        *    the current thread, this method returns the Status.NoTransaction
  126        *    value.
  127        *
  128        * @exception SystemException Thrown if the transaction manager
  129        *    encounters an unexpected error condition.
  130        *
  131        */
  132       int getStatus() throws SystemException;
  133   
  134       /**
  135        * Modify the timeout value that is associated with transactions started
  136        * by the current thread with the begin method.
  137        *
  138        * <p> If an application has not called this method, the transaction
  139        * service uses some default value for the transaction timeout.
  140        *
  141        * @param seconds The value of the timeout in seconds. If the value is zero,
  142        *        the transaction service restores the default value. If the value
  143        *        is negative a SystemException is thrown.
  144        *
  145        * @exception SystemException Thrown if the transaction manager
  146        *    encounters an unexpected error condition.
  147        *
  148        */
  149       void setTransactionTimeout(int seconds) throws SystemException;
  150   }

Save This Page
Home » glassfish-v2ur2-b04-src » javax » transaction » [javadoc | source]