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