org.objectweb.joram.client.jms
Class XAResourceMngr

java.lang.Object
  extended by org.objectweb.joram.client.jms.XAResourceMngr

public class XAResourceMngr
extends java.lang.Object

Utility class used by XA connections for managing XA resources.


Field Summary
(package private)  Connection cnx
          The connection this manager belongs to.
private static org.objectweb.util.monolog.api.Logger logger
           
static int PREPARED
          Prepared transaction.
static int ROLLBACK_ONLY
          Failed transaction.
(package private)  java.util.Hashtable sessionTable
          table of Session (key Xid).
static int STARTED
          Transaction active.
static int SUCCESS
          Transaction successful.
static int SUSPENDED
          Transaction suspended.
private  java.util.Hashtable transactions
          The table of known transactions.
 
Constructor Summary
XAResourceMngr(Connection cnx)
          Creates a XAResourceMngr instance.
 
Method Summary
(package private)  void commit(javax.transaction.xa.Xid xid)
          Notifies the RM that a transaction is commited.
(package private)  void end(javax.transaction.xa.Xid xid, int flag, Session sess)
          Notifies the RM that a transaction is ended.
 boolean equals(java.lang.Object o)
          Resource managers are equal if they belong to the same connection.
private  int getStatus(javax.transaction.xa.Xid xid)
          Gets the status of a transaction.
 int hashCode()
           
(package private)  void prepare(javax.transaction.xa.Xid xid)
          Notifies the RM that a transaction is prepared.
(package private)  javax.transaction.xa.Xid[] recover(int flag)
          Notifies the RM to recover the prepared transactions.
(package private)  void rollback(javax.transaction.xa.Xid xid)
          Notifies the RM that a transaction is rolled back.
private  void setStatus(javax.transaction.xa.Xid xid, int status)
          Sets the status of a transaction.
(package private)  void start(javax.transaction.xa.Xid xid, int flag, Session sess)
          Notifies the RM that a transaction is starting.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STARTED

public static final int STARTED
Transaction active.

See Also:
Constant Field Values

SUSPENDED

public static final int SUSPENDED
Transaction suspended.

See Also:
Constant Field Values

SUCCESS

public static final int SUCCESS
Transaction successful.

See Also:
Constant Field Values

ROLLBACK_ONLY

public static final int ROLLBACK_ONLY
Failed transaction.

See Also:
Constant Field Values

PREPARED

public static final int PREPARED
Prepared transaction.

See Also:
Constant Field Values

logger

private static org.objectweb.util.monolog.api.Logger logger

transactions

private java.util.Hashtable transactions
The table of known transactions.

Key: transaction identifier
Object: XAContext instance


cnx

Connection cnx
The connection this manager belongs to.


sessionTable

java.util.Hashtable sessionTable
table of Session (key Xid).

Constructor Detail

XAResourceMngr

public XAResourceMngr(Connection cnx)
Creates a XAResourceMngr instance.

Parameters:
cnx - The connection this manager belongs to.
Method Detail

start

void start(javax.transaction.xa.Xid xid,
           int flag,
           Session sess)
     throws javax.transaction.xa.XAException
Notifies the RM that a transaction is starting.

Throws:
javax.transaction.xa.XAException - If the specified transaction is already known by the RM in an incompatible state with the start request.

end

void end(javax.transaction.xa.Xid xid,
         int flag,
         Session sess)
   throws javax.transaction.xa.XAException
Notifies the RM that a transaction is ended.

Throws:
javax.transaction.xa.XAException - If the specified transaction is in an incompatible state with the end request.

prepare

void prepare(javax.transaction.xa.Xid xid)
       throws javax.transaction.xa.XAException
Notifies the RM that a transaction is prepared.

Throws:
javax.transaction.xa.XAException - If the specified transaction is in an incompatible state with the prepare request, or if the request fails.

commit

void commit(javax.transaction.xa.Xid xid)
      throws javax.transaction.xa.XAException
Notifies the RM that a transaction is commited.

Throws:
javax.transaction.xa.XAException - If the specified transaction is in an incompatible state with the commit request, or if the request fails.

rollback

void rollback(javax.transaction.xa.Xid xid)
        throws javax.transaction.xa.XAException
Notifies the RM that a transaction is rolled back.

Throws:
javax.transaction.xa.XAException - If the specified transaction is in an incompatible state with the rollback request, or if the request fails.

recover

javax.transaction.xa.Xid[] recover(int flag)
                             throws javax.transaction.xa.XAException
Notifies the RM to recover the prepared transactions.

Throws:
javax.transaction.xa.XAException - If the specified flag is invalid, or if the request fails.

setStatus

private void setStatus(javax.transaction.xa.Xid xid,
                       int status)
                throws javax.transaction.xa.XAException
Sets the status of a transaction.

Throws:
javax.transaction.xa.XAException - If the transaction is unknown.

getStatus

private int getStatus(javax.transaction.xa.Xid xid)
               throws javax.transaction.xa.XAException
Gets the status of a transaction.

Throws:
javax.transaction.xa.XAException - If the transaction is unknown.

equals

public boolean equals(java.lang.Object o)
Resource managers are equal if they belong to the same connection.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.