Package org.ow2.joram.jakarta.jms
Class XASession
- java.lang.Object
-
- org.ow2.joram.jakarta.jms.XASession
-
- All Implemented Interfaces:
jakarta.jms.Session,jakarta.jms.XASession,AutoCloseable,Runnable
- Direct Known Subclasses:
XAQueueSession,XATopicSession
public class XASession extends Object implements jakarta.jms.XASession
Implements thejakarta.jms.XASessioninterface.An XA session actually extends the behaviour of a normal session by providing an XA resource representing it to a Transaction Manager, so that it is part of a distributed transaction. The XASession wraps what looks like a "normal" Session object. This object takes care of producing and consuming messages, the actual sendings and acknowledgement being managed by this XA wrapper.
This class offers support to transactional environments. Client programs are strongly encouraged to use the transactional support available in their environment, rather than use these XA interfaces directly.
-
-
Field Summary
Fields Modifier and Type Field Description protected Sessionsessprivate XAResourcexaResourceThe XA resource representing the session to the transaction manager.
-
Constructor Summary
Constructors Constructor Description XASession(Connection cnx, Session sess, XAResourceMngr rm)Constructs anXASession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()API method.voidcommit()API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).jakarta.jms.QueueBrowsercreateBrowser(jakarta.jms.Queue queue)Delegates the call to the wrapped JMS session.jakarta.jms.QueueBrowsercreateBrowser(jakarta.jms.Queue queue, String selector)Delegates the call to the wrapped JMS session.jakarta.jms.BytesMessagecreateBytesMessage()Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateConsumer(jakarta.jms.Destination dest)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateConsumer(jakarta.jms.Destination dest, String selector)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateConsumer(jakarta.jms.Destination dest, String selector, boolean noLocal)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateDurableConsumer(jakarta.jms.Topic topic, String name)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateDurableConsumer(jakarta.jms.Topic topic, String name, String messageSelector, boolean noLocal)Delegates the call to the wrapped JMS session.jakarta.jms.TopicSubscribercreateDurableSubscriber(jakarta.jms.Topic topic, String name)Delegates the call to the wrapped JMS session.jakarta.jms.TopicSubscribercreateDurableSubscriber(jakarta.jms.Topic topic, String name, String selector, boolean noLocal)Delegates the call to the wrapped JMS session.jakarta.jms.MapMessagecreateMapMessage()Delegates the call to the wrapped JMS session.jakarta.jms.MessagecreateMessage()Delegates the call to the wrapped JMS session.jakarta.jms.ObjectMessagecreateObjectMessage()Delegates the call to the wrapped JMS session.jakarta.jms.ObjectMessagecreateObjectMessage(Serializable obj)Delegates the call to the wrapped JMS session.jakarta.jms.MessageProducercreateProducer(jakarta.jms.Destination dest)Delegates the call to the wrapped JMS session.jakarta.jms.QueuecreateQueue(String queueName)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateSharedConsumer(jakarta.jms.Topic topic, String sharedSubscriptionName)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateSharedConsumer(jakarta.jms.Topic topic, String sharedSubscriptionName, String messageSelector)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateSharedDurableConsumer(jakarta.jms.Topic topic, String name)Delegates the call to the wrapped JMS session.jakarta.jms.MessageConsumercreateSharedDurableConsumer(jakarta.jms.Topic topic, String name, String messageSelector)Delegates the call to the wrapped JMS session.jakarta.jms.StreamMessagecreateStreamMessage()Delegates the call to the wrapped JMS session.jakarta.jms.TemporaryQueuecreateTemporaryQueue()Delegates the call to the wrapped JMS session.jakarta.jms.TemporaryTopiccreateTemporaryTopic()Delegates the call to the wrapped JMS session.jakarta.jms.TextMessagecreateTextMessage()Delegates the call to the wrapped JMS session.jakarta.jms.TextMessagecreateTextMessage(String text)Delegates the call to the wrapped JMS session.jakarta.jms.TopiccreateTopic(String topicName)Delegates the call to the wrapped JMS session.intgetAcknowledgeMode()Delegates the call to the wrapped JMS session.SessiongetDelegateSession()jakarta.jms.MessageListenergetMessageListener()Delegates the call to the wrapped JMS session.jakarta.jms.SessiongetSession()API method.booleangetTransacted()API method.XAResourcegetXAResource()API method.voidrecover()API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).voidrollback()API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).voidrun()Delegates the call to the wrapped JMS session.voidsetMessageListener(jakarta.jms.MessageListener messageListener)Delegates the call to the wrapped JMS session.StringtoString()Returns a String image of this session.voidunsubscribe(String name)Delegates the call to the wrapped JMS session.
-
-
-
Field Detail
-
xaResource
private XAResource xaResource
The XA resource representing the session to the transaction manager.
-
sess
protected Session sess
-
-
Constructor Detail
-
XASession
public XASession(Connection cnx, Session sess, XAResourceMngr rm) throws jakarta.jms.JMSException
Constructs anXASession.This constructor is called by subclasses.
- Parameters:
cnx- The connection the session belongs to.sess- The wrapped "regular" session.rm- The resource manager.- Throws:
jakarta.jms.JMSException- Actually never thrown.
-
-
Method Detail
-
getDelegateSession
public final Session getDelegateSession()
-
toString
public String toString()
Returns a String image of this session.
-
getSession
public jakarta.jms.Session getSession() throws jakarta.jms.JMSExceptionAPI method. Gets the session associated with this XASession.- Specified by:
getSessionin interfacejakarta.jms.XASession- Returns:
- the session object.
- Throws:
jakarta.jms.IllegalStateException- If the session is closed.jakarta.jms.JMSException
-
getXAResource
public XAResource getXAResource()
API method. Returns an XA resource to the caller.- Specified by:
getXAResourcein interfacejakarta.jms.XASession- Returns:
- an XA resource.
-
getTransacted
public boolean getTransacted() throws jakarta.jms.JMSExceptionAPI method. Indicates whether the session is in transacted mode.- Specified by:
getTransactedin interfacejakarta.jms.Session- Specified by:
getTransactedin interfacejakarta.jms.XASession- Returns:
- true
- Throws:
jakarta.jms.IllegalStateException- If the session is closed.jakarta.jms.JMSException
-
createBrowser
public jakarta.jms.QueueBrowser createBrowser(jakarta.jms.Queue queue, String selector) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createBrowserin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createBrowser
public jakarta.jms.QueueBrowser createBrowser(jakarta.jms.Queue queue) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createBrowserin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createProducer
public jakarta.jms.MessageProducer createProducer(jakarta.jms.Destination dest) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createProducerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createConsumer
public jakarta.jms.MessageConsumer createConsumer(jakarta.jms.Destination dest, String selector, boolean noLocal) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createConsumer
public jakarta.jms.MessageConsumer createConsumer(jakarta.jms.Destination dest, String selector) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createConsumer
public jakarta.jms.MessageConsumer createConsumer(jakarta.jms.Destination dest) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createDurableSubscriber
public jakarta.jms.TopicSubscriber createDurableSubscriber(jakarta.jms.Topic topic, String name, String selector, boolean noLocal) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createDurableSubscriberin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createDurableSubscriber
public jakarta.jms.TopicSubscriber createDurableSubscriber(jakarta.jms.Topic topic, String name) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createDurableSubscriberin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
commit
public void commit() throws jakarta.jms.JMSExceptionAPI method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).- Specified by:
commitin interfacejakarta.jms.Session- Specified by:
commitin interfacejakarta.jms.XASession- Throws:
jakarta.jms.IllegalStateException- Systematically thrown.jakarta.jms.JMSException
-
rollback
public void rollback() throws jakarta.jms.JMSExceptionAPI method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).- Specified by:
rollbackin interfacejakarta.jms.Session- Specified by:
rollbackin interfacejakarta.jms.XASession- Throws:
jakarta.jms.IllegalStateException- Systematically thrown.jakarta.jms.JMSException
-
recover
public void recover() throws jakarta.jms.JMSExceptionAPI method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).- Specified by:
recoverin interfacejakarta.jms.Session- Throws:
jakarta.jms.IllegalStateException- Systematically thrown.jakarta.jms.JMSException
-
close
public void close() throws jakarta.jms.JMSExceptionAPI method. Closes the session.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException- Actually never thrown.- See Also:
Session.close
-
run
public void run()
Delegates the call to the wrapped JMS session.
-
unsubscribe
public void unsubscribe(String name) throws jakarta.jms.JMSException
Delegates the call to the wrapped JMS session.- Specified by:
unsubscribein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createTemporaryQueue
public jakarta.jms.TemporaryQueue createTemporaryQueue() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createTemporaryQueuein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createTemporaryTopic
public jakarta.jms.TemporaryTopic createTemporaryTopic() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createTemporaryTopicin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createTopic
public jakarta.jms.Topic createTopic(String topicName) throws jakarta.jms.JMSException
Delegates the call to the wrapped JMS session.- Specified by:
createTopicin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createQueue
public jakarta.jms.Queue createQueue(String queueName) throws jakarta.jms.JMSException
Delegates the call to the wrapped JMS session.- Specified by:
createQueuein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
setMessageListener
public void setMessageListener(jakarta.jms.MessageListener messageListener) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
setMessageListenerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
getMessageListener
public jakarta.jms.MessageListener getMessageListener() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
getMessageListenerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
getAcknowledgeMode
public int getAcknowledgeMode() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
getAcknowledgeModein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createTextMessage
public jakarta.jms.TextMessage createTextMessage() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createTextMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createTextMessage
public jakarta.jms.TextMessage createTextMessage(String text) throws jakarta.jms.JMSException
Delegates the call to the wrapped JMS session.- Specified by:
createTextMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createStreamMessage
public jakarta.jms.StreamMessage createStreamMessage() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createStreamMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createObjectMessage
public jakarta.jms.ObjectMessage createObjectMessage() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createObjectMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createObjectMessage
public jakarta.jms.ObjectMessage createObjectMessage(Serializable obj) throws jakarta.jms.JMSException
Delegates the call to the wrapped JMS session.- Specified by:
createObjectMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createMessage
public jakarta.jms.Message createMessage() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createMapMessage
public jakarta.jms.MapMessage createMapMessage() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createMapMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createBytesMessage
public jakarta.jms.BytesMessage createBytesMessage() throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createBytesMessagein interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createSharedConsumer
public jakarta.jms.MessageConsumer createSharedConsumer(jakarta.jms.Topic topic, String sharedSubscriptionName) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createSharedConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createSharedConsumer
public jakarta.jms.MessageConsumer createSharedConsumer(jakarta.jms.Topic topic, String sharedSubscriptionName, String messageSelector) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createSharedConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createDurableConsumer
public jakarta.jms.MessageConsumer createDurableConsumer(jakarta.jms.Topic topic, String name) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createDurableConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createDurableConsumer
public jakarta.jms.MessageConsumer createDurableConsumer(jakarta.jms.Topic topic, String name, String messageSelector, boolean noLocal) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createDurableConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createSharedDurableConsumer
public jakarta.jms.MessageConsumer createSharedDurableConsumer(jakarta.jms.Topic topic, String name) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createSharedDurableConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
createSharedDurableConsumer
public jakarta.jms.MessageConsumer createSharedDurableConsumer(jakarta.jms.Topic topic, String name, String messageSelector) throws jakarta.jms.JMSExceptionDelegates the call to the wrapped JMS session.- Specified by:
createSharedDurableConsumerin interfacejakarta.jms.Session- Throws:
jakarta.jms.JMSException
-
-