org.objectweb.joram.client.jms
Class XASession

java.lang.Object
  extended byorg.objectweb.joram.client.jms.Session
      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 Session
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
          An XA Session actually wraps what looks like a "normal" session object.
 
Fields inherited from class org.objectweb.joram.client.jms.Session
messageListener
 
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()
          API method inherited from session, but intercepted here for adapting its behaviour to the XA context.
 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.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.MessageProducer createProducer(javax.jms.Destination dest)
          Delegates the call to the wrapped JMS session.
 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()
          API method inherited from session, but intercepted here for adapting its behaviour to the XA context.
 java.lang.String toString()
          Returns a String image of this session.
 
Methods inherited from class org.objectweb.joram.client.jms.Session
createBytesMessage, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createQueue, createStreamMessage, createTemporaryQueue, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, getAcknowledgeMode, getMessageListener, setMessageListener, setTransacted, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.Session
createBytesMessage, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createQueue, createStreamMessage, createTemporaryQueue, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, getAcknowledgeMode, getMessageListener, setMessageListener, unsubscribe
 

Field Detail

sess

protected Session sess
An XA Session actually wraps what looks like a "normal" session object.

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

toString

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

Overrides:
toString in class 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
Overrides:
getTransacted in class Session
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
Overrides:
createBrowser in class 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
Overrides:
createBrowser in class 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
Overrides:
createProducer in class Session
Throws:
javax.jms.JMSException - If the creation fails for any other reason.

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
Overrides:
createConsumer in class Session
Throws:
javax.jms.JMSException - If the creation fails for any other reason.

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
Overrides:
createConsumer in class Session
Throws:
javax.jms.JMSException - If the creation fails for any other reason.

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
Overrides:
createConsumer in class Session
Throws:
javax.jms.JMSException - If the creation fails for any other reason.

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
Overrides:
createDurableSubscriber in class Session
Throws:
javax.jms.JMSException - If the creation fails for any other reason.

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
Overrides:
createDurableSubscriber in class Session
Throws:
javax.jms.JMSException - If the creation fails for any other reason.

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
Overrides:
commit in class Session
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
Overrides:
rollback in class Session
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
Overrides:
recover in class Session
Throws:
javax.jms.IllegalStateException - Systematically thrown.
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
API method inherited from session, but intercepted here for adapting its behaviour to the XA context.

Specified by:
close in interface javax.jms.Session
Overrides:
close in class Session
Throws:
javax.jms.JMSException - Actually never thrown.

run

public void run()
API method inherited from session, but intercepted here for adapting its behaviour to the XA context.

This method processes asynchronous deliveries coming from a connection consumer by passing them to the wrapped session.

Specified by:
run in interface javax.jms.Session
Overrides:
run in class Session


Copyright ? 2004 Scalagent - All rights reserved