corba/src/java.sql/share/classes/javax/transaction/xa/XAResource.java
author chegar
Sun, 17 Aug 2014 15:51:44 +0100
changeset 25862 a5e25d68f971
parent 5555 corba/src/share/classes/javax/transaction/xa/XAResource.java@b2b5ed3f0d0d
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
/*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     2
 * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
 *
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    23
 * questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
package javax.transaction.xa;
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
/** <p>The XAResource interface is a Java mapping of the industry standard
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
  * XA interface based on the X/Open CAE Specification (Distributed
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
  * Transaction Processing: The XA Specification).
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
  *
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
  * <p>The XA interface defines the contract between a Resource Manager
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
  * and a Transaction Manager in a distributed transaction processing
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
  * (DTP) environment. A JDBC driver or a JMS provider implements
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
  * this interface to support the association between a global transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
  * and a database or message service connection.
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
  *
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
  * <p>The XAResource interface can be supported by any transactional
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
  * resource that is intended to be used by application programs in an
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
  * environment where transactions are controlled by an external
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
  * transaction manager. An example of such a resource is a database
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
  * management system. An application may access data through multiple
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
  * database connections. Each database connection is enlisted with
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
  * the transaction manager as a transactional resource. The transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
  * manager obtains an XAResource for each connection participating
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
  * in a global transaction. The transaction manager uses the
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
  * <code>start</code> method
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
  * to associate the global transaction with the resource, and it uses the
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
  * <code>end</code> method to disassociate the transaction from
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
  * the resource. The resource
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
  * manager is responsible for associating the global transaction to all
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
  * work performed on its data between the start and end method invocations.
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
  *
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
  * <p>At transaction commit time, the resource managers are informed by
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
  * the transaction manager to prepare, commit, or rollback a transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
  * according to the two-phase commit protocol.</p>
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
  *
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
  */
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
public interface XAResource
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
{
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
    /** Commits the global transaction specified by xid.
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
      * @param xid A global transaction identifier
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
      * @param onePhase If true, the resource manager should use a one-phase
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
      * commit protocol to commit the work done on behalf of xid.
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
      * @exception XAException An error has occurred. Possible XAExceptions
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
      * are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
      * XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
      * <P>If the resource manager did not commit the transaction and the
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
      *  paramether onePhase is set to true, the resource manager may throw
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
      *  one of the XA_RB* exceptions. Upon return, the resource manager has
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
      *  rolled back the branch's work and has released all held resources.
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
    void commit(Xid xid, boolean onePhase) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
    /** Ends the work performed on behalf of a transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
      * The resource manager disassociates the XA resource from the
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
      * transaction branch specified and lets the transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
      * complete.
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
      * <p>If TMSUSPEND is specified in the flags, the transaction branch
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
      * is temporarily suspended in an incomplete state. The transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
      * context is in a suspended state and must be resumed via the
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
      * <code>start</code> method with TMRESUME specified.</p>
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
      * <p>If TMFAIL is specified, the portion of work has failed.
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
      * The resource manager may mark the transaction as rollback-only</p>
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
      * <p>If TMSUCCESS is specified, the portion of work has completed
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
      * successfully.</p>
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
      * @param xid A global transaction identifier that is the same as
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
      * the identifier used previously in the <code>start</code> method.
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
      * @param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND.
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
      * @exception XAException An error has occurred. Possible XAException
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
      * values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL,
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
      * XAER_PROTO, or XA_RB*.
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
    void end(Xid xid, int flags) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
    /** Tells the resource manager to forget about a heuristically
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
      * completed transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
      * @param xid A global transaction identifier.
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
      * @exception XAException An error has occurred. Possible exception
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
      * values are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
      * XAER_PROTO.
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
    void forget(Xid xid) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
    /** Obtains the current transaction timeout value set for this
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
      * XAResource instance. If <CODE>XAResource.setTransactionTimeout</CODE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
      * was not used prior to invoking this method, the return value
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
      * is the default timeout set for the resource manager; otherwise,
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
      * the value used in the previous <CODE>setTransactionTimeout</CODE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
      * call is returned.
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
      * @return the transaction timeout value in seconds.
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
      * @exception XAException An error has occurred. Possible exception
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
      * values are XAER_RMERR and XAER_RMFAIL.
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
    int getTransactionTimeout() throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
    /** This method is called to determine if the resource manager
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
      * instance represented by the target object is the same as the
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
      * resouce manager instance represented by the parameter <i>xares</i>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
      * @param xares An XAResource object whose resource manager instance
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
      *      is to be compared with the resource manager instance of the
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
      *      target object.
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
      * @return <i>true</i> if it's the same RM instance; otherwise
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
      *       <i>false</i>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
      * @exception XAException An error has occurred. Possible exception
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
      * values are XAER_RMERR and XAER_RMFAIL.
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
    boolean isSameRM(XAResource xares) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
    /** Ask the resource manager to prepare for a transaction commit
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
      * of the transaction specified in xid.
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
      * @param xid A global transaction identifier.
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
      * @exception XAException An error has occurred. Possible exception
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
      * values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
      * or XAER_PROTO.
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
      * @return A value indicating the resource manager's vote on the
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
      * outcome of the transaction. The possible values are: XA_RDONLY
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
      * or XA_OK. If the resource manager wants to roll back the
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
      * transaction, it should do so by raising an appropriate XAException
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
      * in the prepare method.
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
    int prepare(Xid xid) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
    /** Obtains a list of prepared transaction branches from a resource
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
      * manager. The transaction manager calls this method during recovery
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
      * to obtain the list of transaction branches that are currently in
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
      * prepared or heuristically completed states.
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
      * @param flag One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
      * must be used when no other flags are set in the parameter.
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
      * @exception XAException An error has occurred. Possible values are
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
      * XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
      * @return The resource manager returns zero or more XIDs of the
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
      * transaction branches that are currently in a prepared or
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
      * heuristically completed state. If an error occurs during the
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
      * operation, the resource manager should throw the appropriate
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
      * XAException.
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
    Xid[] recover(int flag) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
    /** Informs the resource manager to roll back work done on behalf
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
      * of a transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
      * @param xid A global transaction identifier.
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
      * @exception XAException An error has occurred.
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
    void rollback(Xid xid) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
    /** <P>Sets the current transaction timeout value for this <CODE>XAResource</CODE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
      * instance. Once set, this timeout value is effective until
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
      * <code>setTransactionTimeout</code> is invoked again with a different
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
      * value. To reset the timeout value to the default value used by the resource
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
      * manager, set the value to zero.
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
      * If the timeout operation is performed successfully, the method returns
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
      * <i>true</i>; otherwise <i>false</i>. If a resource manager does not
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
      * support explicitly setting the transaction timeout value, this method
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
      * returns <i>false</i>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
      * @param seconds The transaction timeout value in seconds.
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
      * @return <i>true</i> if the transaction timeout value is set successfully;
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
      *       otherwise <i>false</i>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
      * @exception XAException An error has occurred. Possible exception values
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
      * are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
    boolean setTransactionTimeout(int seconds) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
    /** Starts work on behalf of a transaction branch specified in
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
      * <code>xid</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
      * If TMJOIN is specified, the start applies to joining a transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
      * previously seen by the resource manager. If TMRESUME is specified,
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
      * the start applies to resuming a suspended transaction specified in the
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
      * parameter <code>xid</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
      * If neither TMJOIN nor TMRESUME is specified and the transaction
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
      * specified by <code>xid</code> has previously been seen by the resource
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
      * manager, the resource manager throws the XAException exception with
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
      * XAER_DUPID error code.
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
      * @param xid A global transaction identifier to be associated
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
      * with the resource.
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
      * @param flags One of TMNOFLAGS, TMJOIN, or TMRESUME.
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
      * @exception XAException An error has occurred. Possible exceptions
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
      * are XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE,
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
      * XAER_NOTA, XAER_INVAL, or XAER_PROTO.
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
      *
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
    void start(Xid xid, int flags) throws XAException;
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
      * Ends a recovery scan.
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
    public final static int TMENDRSCAN =   0x00800000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
      * Disassociates the caller and marks the transaction branch
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
      * rollback-only.
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
    public final static int TMFAIL =       0x20000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   264
02bb8761fcce Initial load
duke
parents:
diff changeset
   265
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   266
      * Caller is joining existing transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
   267
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   268
    public final static int TMJOIN =       0x00200000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   269
02bb8761fcce Initial load
duke
parents:
diff changeset
   270
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   271
      * Use TMNOFLAGS to indicate no flags value is selected.
02bb8761fcce Initial load
duke
parents:
diff changeset
   272
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   273
    public final static int TMNOFLAGS =     0x00000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   274
02bb8761fcce Initial load
duke
parents:
diff changeset
   275
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   276
      * Caller is using one-phase optimization.
02bb8761fcce Initial load
duke
parents:
diff changeset
   277
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   278
    public final static int TMONEPHASE =   0x40000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   279
02bb8761fcce Initial load
duke
parents:
diff changeset
   280
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   281
      * Caller is resuming association with a suspended
02bb8761fcce Initial load
duke
parents:
diff changeset
   282
      * transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
   283
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   284
    public final static int TMRESUME =     0x08000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   285
02bb8761fcce Initial load
duke
parents:
diff changeset
   286
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   287
      * Starts a recovery scan.
02bb8761fcce Initial load
duke
parents:
diff changeset
   288
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   289
    public final static int TMSTARTRSCAN = 0x01000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   290
02bb8761fcce Initial load
duke
parents:
diff changeset
   291
02bb8761fcce Initial load
duke
parents:
diff changeset
   292
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   293
      * Disassociates caller from a transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
   294
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   295
    public final static int TMSUCCESS =    0x04000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   296
02bb8761fcce Initial load
duke
parents:
diff changeset
   297
02bb8761fcce Initial load
duke
parents:
diff changeset
   298
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   299
      * Caller is suspending (not ending) its association with
02bb8761fcce Initial load
duke
parents:
diff changeset
   300
      * a transaction branch.
02bb8761fcce Initial load
duke
parents:
diff changeset
   301
      */
02bb8761fcce Initial load
duke
parents:
diff changeset
   302
    public final static int TMSUSPEND =    0x02000000;
02bb8761fcce Initial load
duke
parents:
diff changeset
   303
02bb8761fcce Initial load
duke
parents:
diff changeset
   304
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   305
     * The transaction branch has been read-only and has been committed.
02bb8761fcce Initial load
duke
parents:
diff changeset
   306
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   307
    public final static int XA_RDONLY = 0x00000003;
02bb8761fcce Initial load
duke
parents:
diff changeset
   308
02bb8761fcce Initial load
duke
parents:
diff changeset
   309
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   310
     * The transaction work has been prepared normally.
02bb8761fcce Initial load
duke
parents:
diff changeset
   311
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   312
    public final static int XA_OK = 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
   313
02bb8761fcce Initial load
duke
parents:
diff changeset
   314
}