Package org.objectweb.joram.client.jms
Class XAResourceMngr
- java.lang.Object
-
- org.objectweb.joram.client.jms.XAResourceMngr
-
public class XAResourceMngr extends Object
Utility class used by XA connections for managing XA resources.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ConnectioncnxThe connection this manager belongs to.private static org.objectweb.util.monolog.api.Loggerloggerstatic intPREPAREDPrepared transaction.static intROLLBACK_ONLYFailed transaction.(package private) HashtablesessionTabletable of Session (key Xid).static intSTARTEDTransaction active.static intSUCCESSTransaction successful.static intSUSPENDEDTransaction suspended.private HashtabletransactionsThe table of known transactions.
-
Constructor Summary
Constructors Constructor Description XAResourceMngr(Connection cnx)Creates aXAResourceMngrinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidcommit(Xid xid)Notifies the RM that a transaction is commited.(package private) voidend(Xid xid, int flag, Session sess)Notifies the RM that a transaction is ended.booleanequals(Object o)Resource managers are equal if they belong to the same connection.private intgetStatus(Xid xid)Gets the status of a transaction.inthashCode()(package private) voidprepare(Xid xid)Notifies the RM that a transaction is prepared.(package private) Xid[]recover(int flag)Notifies the RM to recover the prepared transactions.(package private) voidrollback(Xid xid)Notifies the RM that a transaction is rolled back.private voidsetStatus(Xid xid, int status)Sets the status of a transaction.(package private) voidstart(Xid xid, int flag, Session sess)Notifies the RM that a transaction is starting.
-
-
-
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 Hashtable transactions
The table of known transactions.Key: transaction identifier
Object:XAContextinstance
-
cnx
Connection cnx
The connection this manager belongs to.
-
sessionTable
Hashtable sessionTable
table of Session (key Xid).
-
-
Constructor Detail
-
XAResourceMngr
public XAResourceMngr(Connection cnx)
Creates aXAResourceMngrinstance.- Parameters:
cnx- The connection this manager belongs to.
-
-
Method Detail
-
start
void start(Xid xid, int flag, Session sess) throws XAException
Notifies the RM that a transaction is starting.- Throws:
XAException- If the specified transaction is already known by the RM in an incompatible state with the start request.
-
end
void end(Xid xid, int flag, Session sess) throws XAException
Notifies the RM that a transaction is ended.- Throws:
XAException- If the specified transaction is in an incompatible state with the end request.
-
prepare
void prepare(Xid xid) throws XAException
Notifies the RM that a transaction is prepared.- Throws:
XAException- If the specified transaction is in an incompatible state with the prepare request, or if the request fails.
-
commit
void commit(Xid xid) throws XAException
Notifies the RM that a transaction is commited.- Throws:
XAException- If the specified transaction is in an incompatible state with the commit request, or if the request fails.
-
rollback
void rollback(Xid xid) throws XAException
Notifies the RM that a transaction is rolled back.- Throws:
XAException- If the specified transaction is in an incompatible state with the rollback request, or if the request fails.
-
recover
Xid[] recover(int flag) throws XAException
Notifies the RM to recover the prepared transactions.- Throws:
XAException- If the specified flag is invalid, or if the request fails.
-
setStatus
private void setStatus(Xid xid, int status) throws XAException
Sets the status of a transaction.- Throws:
XAException- If the transaction is unknown.
-
getStatus
private int getStatus(Xid xid) throws XAException
Gets the status of a transaction.- Throws:
XAException- If the transaction is unknown.
-
equals
public boolean equals(Object o)
Resource managers are equal if they belong to the same connection.
-
-