|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.activemq.ActiveMQSession
org.codehaus.activemq.ActiveMQXASession
The XASession interface extends the capability of Session by adding access to a JMS provider's support for the Java Transaction API (JTA) (optional). This support takes the form of a javax.transaction.xa.XAResource object. The functionality of this object closely resembles that defined by the standard X/Open XA Resource 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. A client of the application server is given what it thinks is a regular JMS Session. Behind the scenes, the application server controls the transaction management of the underlying XASession. The XASession interface is optional. JMS providers are not required to support this interface. This interface is for use by JMS providers to support transactional environments. Client programs are strongly encouraged to use the transactional support available in their environment, rather than use these XA interfaces directly.
Session
,
QueueSession
,
TopicSession
,
XASession
Field Summary |
Fields inherited from class org.codehaus.activemq.ActiveMQSession |
closed, connection, CONSUMER_DISPATCH_ASYNC, CONSUMER_DISPATCH_SYNC, CONSUMER_DISPATCH_UNSET, consumers, currentTransactionId, packetIdGenerator, producers |
Fields inherited from interface javax.jms.Session |
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED |
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
ActiveMQXASession(ActiveMQXAConnection theConnection)
|
Method Summary | |
protected void |
checkClosedXA()
|
void |
close()
overide Session - which needs to rollback if transacted |
void |
commit()
Commits all messages done in this transaction and releases any locks currently held. |
void |
commit(Xid xid,
boolean onePhase)
|
protected void |
doStartTransaction()
This is called before transacted work is done by the session. |
void |
end(Xid xid,
int flags)
|
void |
forget(Xid xid)
|
protected String |
getNextTransactionId()
|
QueueSession |
getQueueSession()
|
Session |
getSession()
|
TopicSession |
getTopicSession()
|
boolean |
getTransacted()
Indicates whether the session is in transacted mode. |
int |
getTransactionTimeout()
|
XAResource |
getXAResource()
|
boolean |
isSameRM(XAResource xaResource)
|
protected boolean |
isXaTransacted()
|
int |
prepare(Xid xid)
|
Xid[] |
recover(int flag)
|
void |
rollback()
Rolls back any messages done in this transaction and releases any locks currently held. |
void |
rollback(Xid xid)
|
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 ActiveMQXASession(ActiveMQXAConnection theConnection) throws JMSException
Method Detail |
public boolean getTransacted() throws JMSException
ActiveMQSession
getTransacted
in interface XASession
getTransacted
in class ActiveMQSession
JMSException
- if there is some internal error.public void rollback() throws JMSException
ActiveMQSession
rollback
in interface XASession
rollback
in class ActiveMQSession
JMSException
- if the JMS provider fails to roll back the transaction due to some internal error.public void commit() throws JMSException
ActiveMQSession
commit
in interface XASession
commit
in class ActiveMQSession
JMSException
- if the JMS provider fails to commit the transaction due to some internal error.public Session getSession() throws JMSException
getSession
in interface XASession
JMSException
public XAResource getXAResource()
getXAResource
in interface XASession
public QueueSession getQueueSession() throws JMSException
getQueueSession
in interface XAQueueSession
JMSException
public TopicSession getTopicSession() throws JMSException
getTopicSession
in interface XATopicSession
JMSException
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 void close() throws JMSException
close
in interface Session
close
in class ActiveMQSession
JMSException
- if the JMS provider fails to close the session due to some internal error.protected void checkClosedXA() throws XAException
XAException
- if the Session is closedprotected boolean isXaTransacted()
isXaTransacted
in class ActiveMQSession
protected String getNextTransactionId()
getNextTransactionId
in class ActiveMQSession
protected void doStartTransaction() throws JMSException
doStartTransaction
in class ActiveMQSession
JMSException
- not associated with an Xid
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |