|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activemq.TransactionContext
A TransactionContext provides the means to control a JMS transaction. It provides a local transaction interface and also an XAResource interface.
An application server controls the transactional assignment of an XASession by obtaining its XAResource. It uses the XAResource to assign the session to a transaction, prepare and commit work on the transaction, and so on. An XAResource provides some fairly sophisticated facilities for interleaving work on multiple transactions, recovering a list of transactions in progress, and so on. A JTA aware JMS provider must fully implement this functionality. This could be done by using the services of a database that supports XA, or a JMS provider may choose to implement this functionality from scratch.
Session
,
QueueSession
,
TopicSession
,
XASession
Field Summary |
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
TransactionContext(ActiveMQConnection connection)
|
Method Summary | |
void |
addSession(ActiveMQSession session)
|
void |
begin()
Start a local transaction. |
void |
commit()
Commits all messages done in this transaction and releases any locks currently held. |
void |
commit(Xid xid,
boolean onePhase)
|
void |
end(Xid xid,
int flags)
|
void |
forget(Xid xid)
|
ActiveMQConnection |
getConnection()
|
LocalTransactionEventListener |
getLocalTransactionEventListener()
|
Object |
getTransactionId()
|
int |
getTransactionTimeout()
|
boolean |
isInLocalTransaction()
|
boolean |
isInXATransaction()
|
boolean |
isSameRM(XAResource xaResource)
|
int |
prepare(Xid xid)
|
Xid[] |
recover(int flag)
|
void |
removeSession(ActiveMQSession session)
|
void |
rollback()
Rolls back any messages done in this transaction and releases any locks currently held. |
void |
rollback(Xid xid)
|
void |
setLocalTransactionEventListener(LocalTransactionEventListener localTransactionEventListener)
Used by the resource adapter to listen to transaction events. |
boolean |
setTransactionTimeout(int seconds)
|
void |
start(Xid xid,
int flags)
Associates a transaction with the resource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TransactionContext(ActiveMQConnection connection)
Method Detail |
public boolean isInXATransaction()
public boolean isInLocalTransaction()
public LocalTransactionEventListener getLocalTransactionEventListener()
public void setLocalTransactionEventListener(LocalTransactionEventListener localTransactionEventListener)
localTransactionEventListener
- The localTransactionEventListener to set.public void addSession(ActiveMQSession session)
public void removeSession(ActiveMQSession session)
public Object getTransactionId()
public void begin() throws JMSException
JMSException
public void rollback() throws JMSException
JMSException
- if the JMS provider fails to roll back the transaction due to some internal error.
IllegalStateException
- if the method is not called by a transacted session.public void commit() throws JMSException
JMSException
- if the JMS provider fails to commit the transaction due to some internal error.
TransactionRolledBackException
- if the transaction is rolled back due to some internal error during
commit.
IllegalStateException
- if the method is not called by a transacted session.public void start(Xid xid, int flags) throws XAException
start
in interface XAResource
XAException
public void end(Xid xid, int flags) throws XAException
end
in interface XAResource
XAException
public int prepare(Xid xid) throws XAException
prepare
in interface XAResource
XAException
public void rollback(Xid xid) throws XAException
rollback
in interface XAResource
XAException
public void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
XAException
public void forget(Xid xid) throws XAException
forget
in interface XAResource
XAException
public boolean isSameRM(XAResource xaResource) throws XAException
isSameRM
in interface XAResource
XAException
public Xid[] recover(int flag) throws XAException
recover
in interface XAResource
XAException
public int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
public boolean setTransactionTimeout(int seconds) throws XAException
setTransactionTimeout
in interface XAResource
XAException
public ActiveMQConnection getConnection()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |