KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tm > recovery > RecoveryLogger


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.tm.recovery;
23
24 import javax.transaction.xa.Xid JavaDoc;
25
26 /**
27  * This is the main interface of the recovery logger service.
28  *
29  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
30  * @author <a HREF="mailto:reverbel@ime.usp.br">Francisco Reverbel</a>
31  * @version $Revision: 37459 $
32  */

33 public interface RecoveryLogger
34 {
35    /**
36     * Should be invoked at the end of the voting phase of the two-phase commit
37     * protocol for a transaction started at this virtual machine.
38     *
39     * @param localTransactionId the local id of the transaction
40     * @param resources an array of stringfied references to the remote
41     * <code>Resource</code> instances that voted commit.
42     * @return a handler that should be invoked at the end of the second phase
43     * of the two-phase commit protocol for the transaction (if the
44     * transaction is not heuristically completed) or after any
45     * heuristic decisions are cleared.
46     */

47    public TxCompletionHandler saveCommitDecision(long localTransactionId,
48                                                  String JavaDoc[] resources);
49
50    /**
51     * Should be invoked at the end of the voting phase of the two-phase commit
52     * protocol for a foreign transaction that arrived at this virtual machine
53     * in a transaction context propagated along with a remote invocation.
54     *
55     * @param localTransactionId the local id assigned to the transaction
56     * @param inboundFormatId the format id field of the incoming
57     * transaction context
58     * @param globalTransactionId the global transaction id field of the
59     * incoming transaction context
60     * @param recoveryCoordinator a stringfied reference to the remote
61     * <code>RecoveryCoordinator</code> instance
62     * @param resources an array of stringfied references to the remote
63     * <code>Resource</code> instances that voted commit.
64     * @return a handler that should be invoked at the end of the second phase
65     * of the two-phase commit protocol for the transaction (if the
66     * transaction is not heuristically completed) or after any
67     * heuristic decisions are cleared.
68     */

69    public TxCompletionHandler savePrepareDecision(long localTransactionId,
70                                                   int inboundFormatId,
71                                                   byte[] globalTransactionId,
72                                                   String JavaDoc recoveryCoordinator,
73                                                   String JavaDoc[] resources);
74
75    /**
76     * Should be invoked at the end of the voting phase of the two-phase commit
77     * protocol for a foreign transaction that arrived at this virtual machine
78     * via JCA transaction inflow.
79     *
80     * @param localTransactionId the local id assigned to the transaction
81     * @param inboundXid the inbound <code>Xid</code>
82     * @param resources an array of stringfied references to the remote
83     * <code>Resource</code> instances that voted commit.
84     * @return a handler that should be invoked at the end of the second phase
85     * of the two-phase commit protocol for the transaction (if the
86     * transaction is not heuristically completed) or after any
87     * heuristic decisions are cleared.
88     */

89    public TxCompletionHandler savePrepareDecision(long localTransactionId,
90                                                   Xid JavaDoc inboundXid,
91                                                   String JavaDoc[] resources);
92
93    /**
94     * Should be invoked for a heuristically completed transaction, at the end
95     * of the second phase of the two-phase commit protocol.
96     *
97     * @param localTransactionId the local id assigned to the transaction
98     * @param foreignTx true for a foreign transaction, false otherwise
99     * @param formatId the format id field of the transaction's <code>Xid</code>
100     * @param globalTransactionId the global id field of the transaction's
101     * <code>Xid</code>
102     * @param inboundBranchQualifier the inbound branch qualifier, in the case
103     * of a foreign transaction that has been imported via JCA
104     * transaction inflow, or null otherwise
105     * @param transactionStatus the transaction status (either
106     * <code>javax.transaction.Status.STATUS_COMMITTED</code> or
107     * <code>javax.transaction.Status.STATUS_ROLLEDBACK</code>)
108     * @param heurStatusCode the heuristic status code, which takes the same
109     * values as the <code>errorCode</code> field of
110     * <code>javax.transaction.xa.XAException</code>
111     * @param locallyDetectedHeuristicHazard true if a heuristic hazard was
112     * detected locally and is still outstanding
113     * @param xaResourceHeuristics array of heuristic status codes for the
114     * <code>XAResource</code> that are in heuristic states
115     * @param remoteResourceHeuristics array of <code>HeuristicStatus</code>
116     * instances for the remote resources that are in heuristic
117     * states.
118     */

119    public void saveHeuristicStatus(long localTransactionId,
120                                    boolean foreignTx,
121                                    int formatId,
122                                    byte[] globalTransactionId,
123                                    byte[] inboundBranchQualifier,
124                                    int transactionStatus,
125                                    int heurStatusCode,
126                                    boolean locallyDetectedHeuristicHazard,
127                                    int[] xaResourceHeuristics,
128                                    HeuristicStatus[] remoteResourceHeuristics);
129    
130    /**
131     * Clears the heuristic status of a heuristically completed transaction.
132     *
133     * @param localTransactionId the local id assigned to the transaction
134     */

135    public void clearHeuristicStatus(long localTransactionId);
136    
137    /**
138     * Should be invoked at recovery time to obtain an array of reader objects
139     * that access the existing transaction log files.
140     *
141     * @return an array that contains one <code>RecoveryLogReader</code>
142     * instance per transaction log file.
143     */

144    public RecoveryLogReader[] getRecoveryLogs();
145
146    /**
147     * Should be invoked at recovery time to obtain an array of reader objects
148     * that access the existing heuristic status log files.
149     *
150     * @return an array that contains one <code>HeuristicStatusLogReader</code>
151     * instance per heuristic status log file.
152     */

153    public HeuristicStatusLogReader[] getHeuristicStatusLogs();
154    
155 }
156
Popular Tags