jdk/src/java.sql/share/classes/javax/transaction/xa/XAResource.java
author mli
Tue, 14 Mar 2017 19:44:52 -0700
changeset 44256 12050b22e372
parent 28298 7fca67ba0b9f
permissions -rw-r--r--
8176721: @since value errors java.sql module Reviewed-by: lancea
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
 *
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 28298
diff changeset
    59
 * @since 1.4
28298
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    60
 */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    61
public interface XAResource {
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    64
     * Commits the global transaction specified by xid.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    65
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    66
     * @param xid A global transaction identifier
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    67
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    68
     * @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
    69
     * 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
    70
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    71
     * @exception XAException An error has occurred. Possible XAExceptions
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    72
     * 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
    73
     * XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    74
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    75
     * <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
    76
     *  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
    77
     *  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
    78
     *  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
    79
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    80
    void commit(Xid xid, boolean onePhase) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    83
     * 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
    84
     * The resource manager disassociates the XA resource from the
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    85
     * transaction branch specified and lets the transaction
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    86
     * complete.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    87
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    88
     * <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
    89
     * is temporarily suspended in an incomplete state. The transaction
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    90
     * 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
    91
     * <code>start</code> method with TMRESUME specified.</p>
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    92
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    93
     * <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
    94
     * 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
    95
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    96
     * <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
    97
     * successfully.</p>
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    98
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
    99
     * @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
   100
     * 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
   101
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   102
     * @param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   103
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   104
     * @exception XAException An error has occurred. Possible XAException
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   105
     * 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
   106
     * XAER_PROTO, or XA_RB*.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   107
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   108
    void end(Xid xid, int flags) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   111
     * Tells the resource manager to forget about a heuristically
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   112
     * completed transaction branch.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   113
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   114
     * @param xid A global transaction identifier.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   115
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   116
     * @exception XAException An error has occurred. Possible exception
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   117
     * 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
   118
     * XAER_PROTO.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   119
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   120
    void forget(Xid xid) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   123
     * Obtains the current transaction timeout value set for this
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   124
     * XAResource instance. If <CODE>XAResource.setTransactionTimeout</CODE>
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   125
     * 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
   126
     * 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
   127
     * the value used in the previous <CODE>setTransactionTimeout</CODE>
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   128
     * call is returned.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   129
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   130
     * @return the transaction timeout value in seconds.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   131
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   132
     * @exception XAException An error has occurred. Possible exception
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   133
     * values are XAER_RMERR and XAER_RMFAIL.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   134
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   135
    int getTransactionTimeout() throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   138
     * 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
   139
     * 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
   140
     * 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
   141
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   142
     * @param xares An XAResource object whose resource manager instance
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   143
     *      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
   144
     *      target object.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   145
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   146
     * @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
   147
     *       <i>false</i>.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   148
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   149
     * @exception XAException An error has occurred. Possible exception
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   150
     * values are XAER_RMERR and XAER_RMFAIL.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   151
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   152
    boolean isSameRM(XAResource xares) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   155
     * 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
   156
     * of the transaction specified in xid.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   157
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   158
     * @param xid A global transaction identifier.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   159
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   160
     * @exception XAException An error has occurred. Possible exception
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   161
     * 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
   162
     * or XAER_PROTO.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   163
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   164
     * @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
   165
     * 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
   166
     * 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
   167
     * 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
   168
     * in the prepare method.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   169
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   170
    int prepare(Xid xid) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   173
     * 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
   174
     * manager. The transaction manager calls this method during recovery
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   175
     * 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
   176
     * prepared or heuristically completed states.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   177
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   178
     * @param flag One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   179
     * 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
   180
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   181
     * @exception XAException An error has occurred. Possible values are
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   182
     * XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   183
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   184
     * @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
   185
     * transaction branches that are currently in a prepared or
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   186
     * heuristically completed state. If an error occurs during the
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   187
     * operation, the resource manager should throw the appropriate
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   188
     * XAException.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   189
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   190
    Xid[] recover(int flag) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   193
     * 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
   194
     * of a transaction branch.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   195
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   196
     * @param xid A global transaction identifier.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   197
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   198
     * @exception XAException An error has occurred.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   199
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   200
    void rollback(Xid xid) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   203
     * 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
   204
     * instance. Once set, this timeout value is effective until
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   205
     * <code>setTransactionTimeout</code> is invoked again with a different
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   206
     * 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
   207
     * manager, set the value to zero.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   208
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   209
     * 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
   210
     * <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
   211
     * support explicitly setting the transaction timeout value, this method
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   212
     * returns <i>false</i>.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   213
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   214
     * @param seconds The transaction timeout value in seconds.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   215
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   216
     * @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
   217
     *       otherwise <i>false</i>.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   218
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   219
     * @exception XAException An error has occurred. Possible exception values
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   220
     * are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   221
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   222
    boolean setTransactionTimeout(int seconds) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   225
     * 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
   226
     * <code>xid</code>.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   227
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   228
     * 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
   229
     * 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
   230
     * 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
   231
     * parameter <code>xid</code>.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   232
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   233
     * 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
   234
     * 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
   235
     * manager, the resource manager throws the XAException exception with
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   236
     * XAER_DUPID error code.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   237
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   238
     * @param xid A global transaction identifier to be associated
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   239
     * with the resource.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   240
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   241
     * @param flags One of TMNOFLAGS, TMJOIN, or TMRESUME.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   242
     *
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   243
     * @exception XAException An error has occurred. Possible exceptions
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   244
     * 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
   245
     * XAER_NOTA, XAER_INVAL, or XAER_PROTO.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   246
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   247
    void start(Xid xid, int flags) throws XAException;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   250
     * Ends a recovery scan.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   251
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   252
    public final static int TMENDRSCAN =   0x00800000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   255
     * Disassociates the caller and marks the transaction branch
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   256
     * rollback-only.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   257
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   258
    public final static int TMFAIL =       0x20000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   261
     * Caller is joining existing transaction branch.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   262
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   263
    public final static int TMJOIN =       0x00200000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   266
     * Use TMNOFLAGS to indicate no flags value is selected.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   267
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   268
    public final static int TMNOFLAGS =     0x00000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   271
     * Caller is using one-phase optimization.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   272
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   273
    public final static int TMONEPHASE =   0x40000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   276
     * Caller is resuming association with a suspended
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   277
     * transaction branch.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   278
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   279
    public final static int TMRESUME =     0x08000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   282
      * Starts a recovery scan.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   283
      */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   284
    public final static int TMSTARTRSCAN = 0x01000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   287
     * Disassociates caller from a transaction branch.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   288
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   289
    public final static int TMSUCCESS =    0x04000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   292
     * Caller is suspending (not ending) its association with
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   293
     * a transaction branch.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   294
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   295
    public final static int TMSUSPEND =    0x02000000;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   298
     * 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
   299
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   300
    public final static int XA_RDONLY = 0x00000003;
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
    /**
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   303
     * The transaction work has been prepared normally.
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   304
     */
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   305
    public final static int XA_OK = 0;
7fca67ba0b9f 8047776: Add module java.transaction to export API javax.transaction
alanb
parents:
diff changeset
   306
}