Joram ${version}

org.objectweb.joram.client.jms
Class XASession

java.lang.Object
  extended byorg.objectweb.joram.client.jms.XASession
All Implemented Interfaces:
java.lang.Runnable, javax.jms.Session, javax.jms.XASession
Direct Known Subclasses:
XAQueueSession, XATopicSession

public class XASession
extends java.lang.Object
implements javax.jms.XASession

Implements the javax.jms.XASession interface.

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.


Field Summary
protected  Session sess
           
 
Fields inherited from interface javax.jms.Session
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED
 
Constructor Summary
XASession(Connection cnx, Session sess, XAResourceMngr rm)
          Constructs an XASession.
 
Method Summary
 void close()
           
 void commit()
          API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).
 javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
          Delegates the call to the wrapped JMS session.
 javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue, java.lang.String selector)
          Delegates the call to the wrapped JMS session.
 javax.jms.BytesMessage createBytesMessage()
           
 javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest)
          Delegates the call to the wrapped JMS session.
 javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest, java.lang.String selector)
          Delegates the call to the wrapped JMS session.
 javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest, java.lang.String selector, boolean noLocal)
          Delegates the call to the wrapped JMS session.
 javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name)
          Delegates the call to the wrapped JMS session.
 javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String selector, boolean noLocal)
          Delegates the call to the wrapped JMS session.
 javax.jms.MapMessage createMapMessage()
           
 javax.jms.Message createMessage()
           
 javax.jms.ObjectMessage createObjectMessage()
           
 javax.jms.ObjectMessage createObjectMessage(java.io.Serializable obj)
           
 javax.jms.MessageProducer createProducer(javax.jms.Destination dest)
          Delegates the call to the wrapped JMS session.
 javax.jms.Queue createQueue(java.lang.String queueName)
           
 javax.jms.StreamMessage createStreamMessage()
           
 javax.jms.TemporaryQueue createTemporaryQueue()
           
 javax.jms.TemporaryTopic createTemporaryTopic()
           
 javax.jms.TextMessage createTextMessage()
           
 javax.jms.TextMessage createTextMessage(java.lang.String text)
           
 javax.jms.Topic createTopic(java.lang.String topicName)
           
 int getAcknowledgeMode()
           
 Session getDelegateSession()
           
 javax.jms.MessageListener getMessageListener()
           
 javax.jms.Session getSession()
          API method.
 boolean getTransacted()
          API method.
 javax.transaction.xa.XAResource getXAResource()
          API method.
 void recover()
          API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).
 void rollback()
          API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).
 void run()
           
 void setMessageListener(javax.jms.MessageListener messageListener)
           
 java.lang.String toString()
          Returns a String image of this session.
 void unsubscribe(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sess

protected Session sess
Constructor Detail

XASession

public XASession(Connection cnx,
                 Session sess,
                 XAResourceMngr rm)
          throws javax.jms.JMSException
Constructs an XASession.

This constructor is called by subclasses.

Parameters:
cnx - The connection the session belongs to.
sess - The wrapped "regular" session.
rm - The resource manager.
Throws:
javax.jms.JMSException - Actually never thrown.
Method Detail

getDelegateSession

public final Session getDelegateSession()

toString

public java.lang.String toString()
Returns a String image of this session.


getSession

public javax.jms.Session getSession()
                             throws javax.jms.JMSException
API method.

Specified by:
getSession in interface javax.jms.XASession
Throws:
javax.jms.IllegalStateException - If the session is closed.
javax.jms.JMSException

getXAResource

public javax.transaction.xa.XAResource getXAResource()
API method.

Specified by:
getXAResource in interface javax.jms.XASession

getTransacted

public boolean getTransacted()
                      throws javax.jms.JMSException
API method.

Specified by:
getTransacted in interface javax.jms.XASession
Throws:
javax.jms.IllegalStateException - If the session is closed.
javax.jms.JMSException

createBrowser

public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue,
                                            java.lang.String selector)
                                     throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createBrowser in interface javax.jms.Session
Throws:
javax.jms.JMSException

createBrowser

public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
                                     throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createBrowser in interface javax.jms.Session
Throws:
javax.jms.JMSException

createProducer

public javax.jms.MessageProducer createProducer(javax.jms.Destination dest)
                                         throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createProducer in interface javax.jms.Session
Throws:
javax.jms.JMSException

createConsumer

public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest,
                                                java.lang.String selector,
                                                boolean noLocal)
                                         throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createConsumer in interface javax.jms.Session
Throws:
javax.jms.JMSException

createConsumer

public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest,
                                                java.lang.String selector)
                                         throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createConsumer in interface javax.jms.Session
Throws:
javax.jms.JMSException

createConsumer

public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest)
                                         throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createConsumer in interface javax.jms.Session
Throws:
javax.jms.JMSException

createDurableSubscriber

public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                         java.lang.String name,
                                                         java.lang.String selector,
                                                         boolean noLocal)
                                                  throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createDurableSubscriber in interface javax.jms.Session
Throws:
javax.jms.JMSException

createDurableSubscriber

public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                         java.lang.String name)
                                                  throws javax.jms.JMSException
Delegates the call to the wrapped JMS session.

Specified by:
createDurableSubscriber in interface javax.jms.Session
Throws:
javax.jms.JMSException

commit

public void commit()
            throws javax.jms.JMSException
API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).

Specified by:
commit in interface javax.jms.XASession
Throws:
javax.jms.IllegalStateException - Systematically thrown.
javax.jms.JMSException

rollback

public void rollback()
              throws javax.jms.JMSException
API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).

Specified by:
rollback in interface javax.jms.XASession
Throws:
javax.jms.IllegalStateException - Systematically thrown.
javax.jms.JMSException

recover

public void recover()
             throws javax.jms.JMSException
API method inherited from session, but intercepted here for forbidding its use in the XA context (as defined by the API).

Specified by:
recover in interface javax.jms.Session
Throws:
javax.jms.IllegalStateException - Systematically thrown.
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
Specified by:
close in interface javax.jms.Session
Throws:
javax.jms.JMSException - Actually never thrown.

run

public void run()
Specified by:
run in interface javax.jms.Session

unsubscribe

public void unsubscribe(java.lang.String name)
                 throws javax.jms.JMSException
Specified by:
unsubscribe in interface javax.jms.Session
Throws:
javax.jms.JMSException

createTemporaryQueue

public javax.jms.TemporaryQueue createTemporaryQueue()
                                              throws javax.jms.JMSException
Specified by:
createTemporaryQueue in interface javax.jms.Session
Throws:
javax.jms.JMSException

createTemporaryTopic

public javax.jms.TemporaryTopic createTemporaryTopic()
                                              throws javax.jms.JMSException
Specified by:
createTemporaryTopic in interface javax.jms.Session
Throws:
javax.jms.JMSException

createTopic

public javax.jms.Topic createTopic(java.lang.String topicName)
                            throws javax.jms.JMSException
Specified by:
createTopic in interface javax.jms.Session
Throws:
javax.jms.JMSException

createQueue

public javax.jms.Queue createQueue(java.lang.String queueName)
                            throws javax.jms.JMSException
Specified by:
createQueue in interface javax.jms.Session
Throws:
javax.jms.JMSException

setMessageListener

public void setMessageListener(javax.jms.MessageListener messageListener)
                        throws javax.jms.JMSException
Specified by:
setMessageListener in interface javax.jms.Session
Throws:
javax.jms.JMSException

getMessageListener

public javax.jms.MessageListener getMessageListener()
                                             throws javax.jms.JMSException
Specified by:
getMessageListener in interface javax.jms.Session
Throws:
javax.jms.JMSException

getAcknowledgeMode

public int getAcknowledgeMode()
                       throws javax.jms.JMSException
Specified by:
getAcknowledgeMode in interface javax.jms.Session
Throws:
javax.jms.JMSException

createTextMessage

public javax.jms.TextMessage createTextMessage()
                                        throws javax.jms.JMSException
Specified by:
createTextMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createTextMessage

public javax.jms.TextMessage createTextMessage(java.lang.String text)
                                        throws javax.jms.JMSException
Specified by:
createTextMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createStreamMessage

public javax.jms.StreamMessage createStreamMessage()
                                            throws javax.jms.JMSException
Specified by:
createStreamMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createObjectMessage

public javax.jms.ObjectMessage createObjectMessage()
                                            throws javax.jms.JMSException
Specified by:
createObjectMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createObjectMessage

public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable obj)
                                            throws javax.jms.JMSException
Specified by:
createObjectMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createMessage

public javax.jms.Message createMessage()
                                throws javax.jms.JMSException
Specified by:
createMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createMapMessage

public javax.jms.MapMessage createMapMessage()
                                      throws javax.jms.JMSException
Specified by:
createMapMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

createBytesMessage

public javax.jms.BytesMessage createBytesMessage()
                                          throws javax.jms.JMSException
Specified by:
createBytesMessage in interface javax.jms.Session
Throws:
javax.jms.JMSException

Joram ${version}

Copyright ? 2005 Scalagent - All rights reserved