KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > store > access > XATransactionController


1 /*
2
3    Derby - Class org.apache.derby.iapi.store.access.XATransactionController
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.store.access;
23
24 import org.apache.derby.iapi.error.StandardException;
25
26 import org.apache.derby.iapi.store.access.TransactionController;
27
28 /**
29
30 This interface allows access to commit,prepare,abort global transactions
31 as part of a two phase commit protocol, during runtime.
32 These interfaces have been chosen to be exact implementations required to
33 implement the XAResource interfaces as part of the JTA standard extension.
34 <P>
35 It is expected that the following interfaces are only used during the
36 runtime portion of a 2 phase commit connection.
37 <P>
38 If a runtime exception causes a transaction abort (of a transaction that
39 has not been successfully prepared), then the transaction will act as if
40 xa_rollback() had been called. The transaction will be aborted and any
41 other call other than destroy will throw exceptions.
42 <P>
43 The XAResource interface is a Java mapping of the industry standard XA resource
44 manager interface. Please refer to: X/Open CAE Specification - Distributed
45 Transaction Processing: The XA Specification, X/Open Document No. XO/CAE/91/300
46 or ISBN 1 872630 24 3.
47 <P>
48 NOTE - all calls to this interface assume that the caller has insured that
49 there is no active work being done on the local instance of the transaction
50 in question. RESOLVE - not sure whether this means that the connection
51 associated with the transaction must be closed, or if it just means that
52 synchronization has been provided to provide correct MT behavior from above.
53
54 **/

55
56 public interface XATransactionController extends TransactionController
57 {
58     /**************************************************************************
59      * Public Methods of This class:
60      **************************************************************************
61      */

62     public static final int XA_RDONLY = 1;
63     public static final int XA_OK = 2;
64
65     /**
66      * This method is called to commit the current XA global transaction.
67      * <p>
68      * Once this call has been made all other calls on this controller other
69      * than destroy will throw exceptions.
70      * <p>
71      *
72      * @param onePhase If true, the resource manager should use a one-phase
73      * commit protocol to commit the work done on behalf of
74      * current xid.
75      *
76      * @exception StandardException Standard exception policy.
77      **/

78     public void xa_commit(
79     boolean onePhase)
80         throws StandardException;
81
82     /**
83      * This method is called to ask the resource manager to prepare for
84      * a transaction commit of the transaction specified in xid.
85      * <p>
86      * If XA_OK is returned then any call other than xa_commit() or xa_abort()
87      * will throw exceptions. If XA_RDONLY is returned then any call other
88      * than destroy() will throw exceptions.
89      *
90      * @return A value indicating the resource manager's vote on the
91      * the outcome of the transaction. The possible values
92      * are: XA_RDONLY or XA_OK. If the resource manager wants
93      * to roll back the transaction, it should do so by
94      * throwing an appropriate XAException in the prepare
95      * method.
96      *
97      * @exception StandardException Standard exception policy.
98      **/

99     public int xa_prepare()
100         throws StandardException;
101
102     /**
103      * rollback the current global transaction.
104      * <p>
105      * The given transaction is roll'ed back and it's history is not
106      * maintained in the transaction table or long term log.
107      * <p>
108      * Once this call has been made all other calls on this controller other
109      * than destroy will throw exceptions.
110      * <p>
111      *
112      * @exception StandardException Standard exception policy.
113      **/

114     public void xa_rollback()
115         throws StandardException;
116 }
117
Popular Tags