org.jboss.mq.pm
Class TxManager

java.lang.Object
  extended by org.jboss.mq.pm.TxManager
All Implemented Interfaces:
Recoverable

public class TxManager
extends Object
implements Recoverable

This class allows provides the base for user supplied persistence packages.

Version:
$Revision: 57198 $
Author:
Hiram Chirino (Cojonudo14@hotmail.com), Paul Kendall (paul.kendall@orion.co.nz), Adrian Brock

Nested Class Summary
static class TxManager.PreparedInfo
          Information about a prepared global transaction
 
Constructor Summary
TxManager(PersistenceManager pm)
          Create a new TxManager
 
Method Summary
 void addPostCommitTask(Tx txId, Runnable task)
          Add an operation for after a commit
 void addPostRollbackTask(Tx txId, Runnable task)
          Add an operation for after a rollback
 void commitTx(ConnectionToken dc, Object xid)
          Commit the transaction to the persistent store.
 void commitTx(Tx txId)
          Commit the transaction to the persistent store.
 Tx createTx()
          Create and return a unique transaction id.
 Tx createTx(ConnectionToken dc, Object xid)
          Create and return a unique transaction id.
 Tx getPrepared(ConnectionToken dc, Object xid)
          Deprecated.  
 Map getPreparedTransactions()
          Get the prepared transactions
 void markPrepared(ConnectionToken dc, Object xid, Tx txId)
          Mark the transaction branch as prepared
 Xid[] recover(ConnectionToken dc, int flags)
          Recover
 void restoreTx(Tx txId)
          Restore a prepared transaction
 void rollbackTx(ConnectionToken dc, Object xid)
          Rollback the transaction
 void rollbackTx(Tx txId)
          Rollback the transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TxManager

public TxManager(PersistenceManager pm)
Create a new TxManager

Parameters:
pm - the persistence manager
Method Detail

getPrepared

public final Tx getPrepared(ConnectionToken dc,
                            Object xid)
                     throws javax.jms.JMSException
Deprecated. 

Return the local transaction id for a distributed transaction id.

Parameters:
dc - the connection
xid - the transaction id
Returns:
The Prepared transaction
Throws:
javax.jms.JMSException - Description of Exception

createTx

public final Tx createTx()
                  throws javax.jms.JMSException
Create and return a unique transaction id.

Returns:
the transaction id
Throws:
javax.jms.JMSException - for any error

commitTx

public final void commitTx(Tx txId)
                    throws javax.jms.JMSException
Commit the transaction to the persistent store.

Parameters:
txId - the transaction
Throws:
javax.jms.JMSException - for any error

commitTx

public final void commitTx(ConnectionToken dc,
                           Object xid)
                    throws javax.jms.JMSException
Commit the transaction to the persistent store.

Parameters:
dc - the connection token
xid - the transaction
Throws:
javax.jms.JMSException - for any error

addPostCommitTask

public void addPostCommitTask(Tx txId,
                              Runnable task)
                       throws javax.jms.JMSException
Add an operation for after a commit

Parameters:
txId - the transaction
task - the task
Throws:
javax.jms.JMSException - for any error

rollbackTx

public void rollbackTx(Tx txId)
                throws javax.jms.JMSException
Rollback the transaction.

Parameters:
txId - the transaction
Throws:
javax.jms.JMSException - for any error

rollbackTx

public final void rollbackTx(ConnectionToken dc,
                             Object xid)
                      throws javax.jms.JMSException
Rollback the transaction

Parameters:
dc - the connection token
xid - the transaction
Throws:
javax.jms.JMSException - for any error

addPostRollbackTask

public void addPostRollbackTask(Tx txId,
                                Runnable task)
                         throws javax.jms.JMSException
Add an operation for after a rollback

Parameters:
txId - the transaction
task - the task
Throws:
javax.jms.JMSException - for any error

createTx

public Tx createTx(ConnectionToken dc,
                   Object xid)
            throws javax.jms.JMSException
Create and return a unique transaction id. Given a distributed connection and a transaction id object, allocate a unique local transaction id if the remote id is not already known.

Parameters:
dc - the connection token
xid - the xid
Returns:
the transaction
Throws:
javax.jms.JMSException - for any error

restoreTx

public void restoreTx(Tx txId)
               throws javax.jms.JMSException
Restore a prepared transaction

Parameters:
txId - the transaction id
Throws:
javax.jms.JMSException - for any error

markPrepared

public void markPrepared(ConnectionToken dc,
                         Object xid,
                         Tx txId)
                  throws javax.jms.JMSException
Mark the transaction branch as prepared

Parameters:
dc - the connection token
xid - the xid
txId - the transaction
Throws:
javax.jms.JMSException - for any error

recover

public Xid[] recover(ConnectionToken dc,
                     int flags)
              throws Exception
Description copied from interface: Recoverable
Recover

Specified by:
recover in interface Recoverable
Parameters:
dc - the connnection token
flags - the recovery flags
Returns:
the xids
Throws:
Exception - for any error

getPreparedTransactions

public Map getPreparedTransactions()
Get the prepared transactions

Returns:


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.