public class XASession extends Object implements XASession
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.
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.
Modifier and Type | Field and Description |
---|---|
protected Session |
sess |
private XAResource |
xaResource
The XA resource representing the session to the transaction manager.
|
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED
Constructor and Description |
---|
XASession(Connection cnx,
Session sess,
XAResourceMngr rm)
Constructs an
XASession . |
Modifier and Type | Method and Description |
---|---|
void |
close()
API method.
|
void |
commit()
API method inherited from session, but intercepted here for
forbidding its use in the XA context (as defined by the API).
|
QueueBrowser |
createBrowser(Queue queue)
Delegates the call to the wrapped JMS session.
|
QueueBrowser |
createBrowser(Queue queue,
String selector)
Delegates the call to the wrapped JMS session.
|
BytesMessage |
createBytesMessage()
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createConsumer(Destination dest)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createConsumer(Destination dest,
String selector)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createConsumer(Destination dest,
String selector,
boolean noLocal)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createDurableConsumer(Topic topic,
String name)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createDurableConsumer(Topic topic,
String name,
String messageSelector,
boolean noLocal)
Delegates the call to the wrapped JMS session.
|
TopicSubscriber |
createDurableSubscriber(Topic topic,
String name)
Delegates the call to the wrapped JMS session.
|
TopicSubscriber |
createDurableSubscriber(Topic topic,
String name,
String selector,
boolean noLocal)
Delegates the call to the wrapped JMS session.
|
MapMessage |
createMapMessage()
Delegates the call to the wrapped JMS session.
|
Message |
createMessage()
Delegates the call to the wrapped JMS session.
|
ObjectMessage |
createObjectMessage()
Delegates the call to the wrapped JMS session.
|
ObjectMessage |
createObjectMessage(Serializable obj)
Delegates the call to the wrapped JMS session.
|
MessageProducer |
createProducer(Destination dest)
Delegates the call to the wrapped JMS session.
|
Queue |
createQueue(String queueName)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createSharedConsumer(Topic topic,
String sharedSubscriptionName)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createSharedConsumer(Topic topic,
String sharedSubscriptionName,
String messageSelector)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createSharedDurableConsumer(Topic topic,
String name)
Delegates the call to the wrapped JMS session.
|
MessageConsumer |
createSharedDurableConsumer(Topic topic,
String name,
String messageSelector)
Delegates the call to the wrapped JMS session.
|
StreamMessage |
createStreamMessage()
Delegates the call to the wrapped JMS session.
|
TemporaryQueue |
createTemporaryQueue()
Delegates the call to the wrapped JMS session.
|
TemporaryTopic |
createTemporaryTopic()
Delegates the call to the wrapped JMS session.
|
TextMessage |
createTextMessage()
Delegates the call to the wrapped JMS session.
|
TextMessage |
createTextMessage(String text)
Delegates the call to the wrapped JMS session.
|
Topic |
createTopic(String topicName)
Delegates the call to the wrapped JMS session.
|
int |
getAcknowledgeMode()
Delegates the call to the wrapped JMS session.
|
Session |
getDelegateSession() |
MessageListener |
getMessageListener()
Delegates the call to the wrapped JMS session.
|
Session |
getSession()
API method.
|
boolean |
getTransacted()
API method.
|
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()
Delegates the call to the wrapped JMS session.
|
void |
setMessageListener(MessageListener messageListener)
Delegates the call to the wrapped JMS session.
|
String |
toString()
Returns a String image of this session.
|
void |
unsubscribe(String name)
Delegates the call to the wrapped JMS session.
|
private XAResource xaResource
protected Session sess
public XASession(Connection cnx, Session sess, XAResourceMngr rm) throws JMSException
XASession
.
This constructor is called by subclasses.
cnx
- The connection the session belongs to.sess
- The wrapped "regular" session.rm
- The resource manager.JMSException
- Actually never thrown.public final Session getDelegateSession()
public String toString()
public Session getSession() throws JMSException
getSession
in interface XASession
IllegalStateException
- If the session is closed.JMSException
public XAResource getXAResource()
getXAResource
in interface XASession
public boolean getTransacted() throws JMSException
getTransacted
in interface Session
getTransacted
in interface XASession
IllegalStateException
- If the session is closed.JMSException
public QueueBrowser createBrowser(Queue queue, String selector) throws JMSException
createBrowser
in interface Session
JMSException
public QueueBrowser createBrowser(Queue queue) throws JMSException
createBrowser
in interface Session
JMSException
public MessageProducer createProducer(Destination dest) throws JMSException
createProducer
in interface Session
JMSException
public MessageConsumer createConsumer(Destination dest, String selector, boolean noLocal) throws JMSException
createConsumer
in interface Session
JMSException
public MessageConsumer createConsumer(Destination dest, String selector) throws JMSException
createConsumer
in interface Session
JMSException
public MessageConsumer createConsumer(Destination dest) throws JMSException
createConsumer
in interface Session
JMSException
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String selector, boolean noLocal) throws JMSException
createDurableSubscriber
in interface Session
JMSException
public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException
createDurableSubscriber
in interface Session
JMSException
public void commit() throws JMSException
commit
in interface Session
commit
in interface XASession
IllegalStateException
- Systematically thrown.JMSException
public void rollback() throws JMSException
rollback
in interface Session
rollback
in interface XASession
IllegalStateException
- Systematically thrown.JMSException
public void recover() throws JMSException
recover
in interface Session
IllegalStateException
- Systematically thrown.JMSException
public void close() throws JMSException
close
in interface Session
JMSException
- Actually never thrown.Session.close
public void run()
public void unsubscribe(String name) throws JMSException
unsubscribe
in interface Session
JMSException
public TemporaryQueue createTemporaryQueue() throws JMSException
createTemporaryQueue
in interface Session
JMSException
public TemporaryTopic createTemporaryTopic() throws JMSException
createTemporaryTopic
in interface Session
JMSException
public Topic createTopic(String topicName) throws JMSException
createTopic
in interface Session
JMSException
public Queue createQueue(String queueName) throws JMSException
createQueue
in interface Session
JMSException
public void setMessageListener(MessageListener messageListener) throws JMSException
setMessageListener
in interface Session
JMSException
public MessageListener getMessageListener() throws JMSException
getMessageListener
in interface Session
JMSException
public int getAcknowledgeMode() throws JMSException
getAcknowledgeMode
in interface Session
JMSException
public TextMessage createTextMessage() throws JMSException
createTextMessage
in interface Session
JMSException
public TextMessage createTextMessage(String text) throws JMSException
createTextMessage
in interface Session
JMSException
public StreamMessage createStreamMessage() throws JMSException
createStreamMessage
in interface Session
JMSException
public ObjectMessage createObjectMessage() throws JMSException
createObjectMessage
in interface Session
JMSException
public ObjectMessage createObjectMessage(Serializable obj) throws JMSException
createObjectMessage
in interface Session
JMSException
public Message createMessage() throws JMSException
createMessage
in interface Session
JMSException
public MapMessage createMapMessage() throws JMSException
createMapMessage
in interface Session
JMSException
public BytesMessage createBytesMessage() throws JMSException
createBytesMessage
in interface Session
JMSException
public MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName) throws JMSException
JMSException
public MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName, String messageSelector) throws JMSException
JMSException
public MessageConsumer createDurableConsumer(Topic topic, String name) throws JMSException
JMSException
public MessageConsumer createDurableConsumer(Topic topic, String name, String messageSelector, boolean noLocal) throws JMSException
JMSException
public MessageConsumer createSharedDurableConsumer(Topic topic, String name) throws JMSException
JMSException
public MessageConsumer createSharedDurableConsumer(Topic topic, String name, String messageSelector) throws JMSException
JMSException
Copyright © 2016 ScalAgent D.T.. All Rights Reserved.