KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tm > TransactionManagerServiceMBean


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;
23
24 import javax.management.ObjectName JavaDoc;
25
26 import org.jboss.mx.util.ObjectNameFactory;
27 import org.jboss.system.ServiceMBean;
28 import org.jboss.tm.integrity.TransactionIntegrityFactory;
29 import org.jboss.tm.recovery.RecoveryLoggerInstance;
30
31 /**
32  * TransactionManagerService MBean interface.
33  *
34  * @see TxManager
35  * @version $Revision: 44337 $
36  */

37 public interface TransactionManagerServiceMBean extends ServiceMBean, TransactionManagerFactory
38 {
39    ObjectName JavaDoc OBJECT_NAME = ObjectNameFactory.create("jboss:service=TransactionManager");
40
41    /**
42     * Set the Recover logger
43     * @param recoveryLogger
44     */

45    void setRecoveryLogger(RecoveryLoggerInstance recoveryLogger);
46    
47    /**
48     * Set the Integrity checker factory
49     *
50     * @param factory the integrity checker factory
51     */

52    void setTransactionIntegrityFactory(TransactionIntegrityFactory factory);
53
54    /**
55     * Describe <code>getGlobalIdsEnabled</code> method here.
56     * @return an <code>boolean</code> value
57     */

58    boolean getGlobalIdsEnabled();
59
60    /**
61     * Describe <code>setGlobalIdsEnabled</code> method here.
62     * @param newValue an <code>boolean</code> value
63     */

64    void setGlobalIdsEnabled(boolean newValue);
65
66    /**
67     * Is thread interruption enabled at transaction timeout
68     * @return true for interrupt threads, false otherwise
69     */

70    boolean isInterruptThreads();
71
72    /**
73     * Enable/disable thread interruption at transaction timeout.
74     * @param interruptThreads pass true to interrupt threads, false otherwise
75     */

76    void setInterruptThreads(boolean interruptThreads);
77
78    /**
79     * Describe <code>getTransactionTimeout</code> method here.
80     * @return an <code>int</code> value
81     */

82    int getTransactionTimeout();
83
84    /**
85     * Describe <code>setTransactionTimeout</code> method here.
86     * @param timeout an <code>int</code> value
87     */

88    void setTransactionTimeout(int timeout);
89
90    /**
91     * Gets the completion retry limit. This is the maximum number of times that
92     * the transaction manager retries a completion operation (either commit or
93     * rollback) on a resource (either a remote <code>Resource</code> or an
94     * <code>XAResource</code>) that raised a transient exception. Whoever called
95     * the transaction manager is blocked while the completion retries are
96     * performed. If the completion retry limit is reached, the transaction
97     * manager abandons the retries and throws a heuristic hazard exception.
98     *
99     * @return the completion retry limit.
100     */

101    int getCompletionRetryLimit();
102
103    /**
104     * Sets the completion retry limit. This is the maximum number of times that
105     * the transaction manager retries a completion operation (either commit or
106     * rollback) on a resource (either a remote <code>Resource</code> or an
107     * <code>XAResource</code>) that raised a transient exception. Whoever called
108     * the transaction manager is blocked while the completion retries are
109     * performed. If the completion retry limit is reached, the transaction
110     * manager abandons the retries and throws a heuristic hazard exception.
111     *
112     * @param maxCompletionRetries the completion retry limit.
113     */

114    void setCompletionRetryLimit(int maxCompletionRetries);
115    
116    /**
117     * Gets the completion retry timeout. The completion retry timeout is the
118     * number of seconds that the transaction manager waits before retrying a
119     * completion operation (either commit or rollback) on a resource (either a
120     * remote <code>Resource</code> or an <code>XAResource</code>) that raised a
121     * transient exception. This is a blocking timeout (whoever called the
122     * transaction manager is blocked until the commit or rollback is retried)
123     * and is applicable if the transaction manager did not report a heuristic
124     * hazard for the transaction. If a heuristic hazard has been reported, then
125     * the applicable timouts are the non-blocking ones: the XA retry timeout and
126     * the prepared timeout.
127     *
128     * @return the timeout (in seconds) for retrying a completion operation
129     * after a transient exception and before the transaction manager
130     * reports a heuristic hazard.
131     */

132    int getCompletionRetryTimeout();
133    
134    /**
135     * Sets the completion retry timeout. The completion retry timeout is the
136     * number of seconds that the transaction manager waits before retrying a
137     * completion operation (either commit or rollback) on a resource (either a
138     * remote <code>Resource</code> or an <code>XAResource</code>) that raised a
139     * transient exception. This is a blocking timeout (whoever called the
140     * transaction manager is blocked until the commit or rollback is retried)
141     * and is applicable if the transaction manager did not report a heuristic
142     * hazard for the transaction. If a heuristic hazard has been reported, then
143     * the applicable timouts are the non-blocking ones: the XA retry timeout and
144     * the prepared timeout.
145     *
146     * @param seconds the timeout (in seconds) for retrying a completion
147     * operation after a transient exception and before the
148     * transaction manager reports a heuristic hazard.
149     */

150    void setCompletionRetryTimeout(int seconds);
151    
152    /**
153     * Gets the XA retry timeout. After reaching the completion retry limit and
154     * reporting a heuristic hazard to its caller, the transaction manager will
155     * still attempt to commit or rollback an XA resource that raised a
156     * transient exception. This is the time interval (in seconds) between XA
157     * completion retries that is applicable if a heuristic hazard has been
158     * reported for a transaction.
159     *
160     * @return the timeout (in seconds) for retrying commit or rollback
161     * operations on XA resources.
162     */

163    int getXARetryTimeout();
164    
165    /**
166     * Sets the XA retry timeout. After reaching the completion retry limit and
167     * reporting a heuristic hazard to its caller, the transaction manager will
168     * still attempt to commit or rollback an XA resource that raised a
169     * transient exception. This is the time interval (in seconds) between XA
170     * completion retries that is applicable if a heuristic hazard has been
171     * reported for a transaction.
172     *
173     * @param seconds the timeout (in seconds) for retrying commit or rollback
174     * operations on XA resources.
175     */

176    void setXARetryTimeout(int seconds);
177    
178    /**
179     * Gets the prepared timeout. A transaction branch that is the prepared
180     * state waits for an amount of time equal to the prepared timeout before
181     * generating a call to <code>replayCompletion</code> on its recovery
182     * coordinator.
183     *
184     * @return the timeout (in seconds) for a transaction branch in the prepared
185     * state.
186     */

187    int getPreparedTimeout();
188    
189    /**
190     * Sets the prepared timeout. A transaction branch that is the prepared
191     * state waits for an amount of time equal to the prepared timeout before
192     * generating a call to <code>replayCompletion</code> on its recovery
193     * coordinator.
194     *
195     * @param seconds the timeout (in seconds) for a transaction branch in the
196     * prepared state.
197     */

198    void setPreparedTimeout(int seconds);
199    
200    /**
201     * Gets the boolean attribute "root branch remembers heuristic decisions".
202     * If this attribute is true, the root branch remembers a heuristically
203     * completed transaction until explicitly told (through a call to the MBean
204     * operation <code>forget</code>) to forget that transaction. If this
205     * attribute is false, the root branch immediately forgets a transaction
206     * when the transaction completes.
207     *
208     * @return true if the root branch remember heuristic decisions,
209     * false otherwise.
210     */

211    boolean isRootBranchRemembersHeuristicDecisions();
212    
213    /**
214     * Sets the boolean attribute "root branch remembers heuristic decisions".
215     * If this attribute is true, the root branch remembers a heuristically
216     * completed transaction until explicitly told (through a call to the MBean
217     * operation <code>forget</code>) to forget that transaction. If this
218     * attribute is false, the root branch immediately forgets a transaction
219     * when the transaction completes.
220     *
221     * @param newValue true if the root branch should remember heuristic
222     * decisions, false otherwise.
223     */

224    void setRootBranchRemembersHeuristicDecisions(boolean newValue);
225    
226    /**
227     * Gets the boolean attribute "report heuristic hazard as heuristic mixed".
228     * If this attribute is true, each of the commit methods of the JTA API
229     * (<code>javax.transaction.Transaction.commit()</code>,
230     * <code>javax.transaction.TransactionManager.commit()</code>, and
231     * <code>javax.transaction.UserTransaction.commit()</code>) throws a
232     * <code>HeuristicMixedException</code> to report a heuristic hazard to its
233     * caller. If the attribute is false, those methods do not report heuristic
234     * hazards to their callers. In any case, transactions with heuristic hazard
235     * status are listed by the MBean operation
236     * <code>listHeuristicallyCompletedTransactions()</code>.
237     *
238     * @return true if a JTA commit throws <code>HeuristicMixedException</code>
239     * to report a heuristic hazard to its caller, or false if a JTA
240     * commit does not report a heuristic hazard to its caller.
241     */

242    boolean isReportHeuristicHazardAsHeuristicMixed();
243    
244    /**
245     * Sets the boolean attribute "report heuristic hazard as heuristic mixed".
246     * If this attribute is true, each of the commit methods of the JTA API
247     * (<code>javax.transaction.Transaction.commit()</code>,
248     * <code>javax.transaction.TransactionManager.commit()</code>, and
249     * <code>javax.transaction.UserTransaction.commit()</code>) throws a
250     * <code>HeuristicMixedException</code> to report a heuristic hazard to its
251     * caller. If the attribute is false, those methods do not report heuristic
252     * hazards to their callers. In any case, transactions with heuristic hazard
253     * status are listed by the MBean operation
254     * <code>listHeuristicallyCompletedTransactions()</code>.
255     *
256     * @param newValue true if a JTA commit should throw
257     * <code>HeuristicMixedException</code> to report a heuristic hazard
258     * to its caller, or false if a JTA commit should not report a
259     * heuristic hazard to its caller.
260     */

261    void setReportHeuristicHazardAsHeuristicMixed(boolean newValue);
262    
263    /**
264     * mbean get-set pair for field xidFactory Get the value of xidFactory
265     * @return value of xidFactory
266     */

267    ObjectName JavaDoc getXidFactory();
268
269    /**
270     * Set the value of xidFactory
271     * @param xidFactory Value to assign to xidFactory
272     */

273    void setXidFactory(ObjectName JavaDoc xidFactory);
274
275    /**
276     * Get the xa terminator
277     * @return the xa terminator
278     */

279    JBossXATerminator getXATerminator();
280
281    /**
282     * Counts the number of transactions
283     * @return the number of active transactions
284     */

285    long getTransactionCount();
286
287    /**
288     * The number of commits.
289     * @return the number of transactions that have been committed
290     */

291    long getCommitCount();
292
293    /**
294     * The number of rollbacks.
295     * @return the number of transactions that have been rolled back
296     */

297    long getRollbackCount();
298
299    /**
300     * Lists the in-doubt transactions.
301     *
302     * @return a string with a text listing of in-doubt transactions.
303     */

304    String JavaDoc listInDoubtTransactions();
305    
306    /**
307     * Heuristically commits an in-doubt transaction.
308     *
309     * @param localTransactionId the local id of the in-doubt transaction to be
310     * heuristically committed.
311     */

312    void heuristicallyCommit(long localTransactionId);
313    
314    /**
315     * Heuristically commits all in-doubt transactions.
316     */

317    void heuristicallyCommitAll();
318    
319    /**
320     * Heuristically rolls back an in-doubt transaction.
321     *
322     * @param localTransactionId the local id of the in-doubt transaction to be
323     * heuristically rolled back.
324     */

325    void heuristicallyRollback(long localTransactionId);
326    
327    /**
328     * Heuristically rolls back all in-doubt transactions.
329     */

330    void heuristicallyRollbackAll();
331    
332    /**
333     * Lists the heuristically completed transactions coordinated by this
334     * transaction manager. A transaction that was heuristically completed
335     * by a call to <code>heuristicallyCommit(long localTransactionId)</code>,
336     * <code>heuristicallyCommitAll()</code>,
337     * <code>heuristicallyRollback(long localTransactionId)</code>, or
338     * <code>heuristicallyRollbackAll()</code> does not appear in the listing,
339     * as that transaction had a foreign coordinator.
340     *
341     * @return a string with a text listing of heuristically completed
342     * transactions.
343     */

344    String JavaDoc listHeuristicallyCompletedTransactions();
345    
346    /**
347     * Forgets a heuristically completed transaction coordinated by this
348     * transaction manager.
349     *
350     * @param localTransactionId the local id of a heuristically completed
351     * transaction coordinated by this transaction
352     * manager.
353     */

354    void forget(long localTransactionId);
355    
356    /**
357     * Forgets all heuristically completed transactions coordinated by this
358     * transaction manager.
359     */

360    void forgetAll();
361    
362    /**
363     * The <code>registerXAExceptionFormatter</code> method
364     * @param clazz a <code>Class</code> value
365     * @param formatter a <code>XAExceptionFormatter</code> value
366     */

367    void registerXAExceptionFormatter(Class JavaDoc clazz, XAExceptionFormatter formatter);
368
369    /**
370     * The <code>unregisterXAExceptionFormatter</code> method
371     * @param clazz a <code>Class</code> value
372     */

373    void unregisterXAExceptionFormatter(Class JavaDoc clazz);
374
375 }
376
Popular Tags