Package org.apache.activemq.jms.pool
Class PooledSession
- java.lang.Object
-
- org.apache.activemq.jms.pool.PooledSession
-
- All Implemented Interfaces:
Runnable
,QueueSession
,Session
,TopicSession
,XASession
public class PooledSession extends Object implements Session, TopicSession, QueueSession, XASession
-
-
Field Summary
-
Fields inherited from interface javax.jms.Session
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED
-
-
Constructor Summary
Constructors Constructor Description PooledSession(SessionKey key, SessionHolder sessionHolder, KeyedObjectPool<SessionKey,SessionHolder> sessionPool, boolean transactional, boolean anonymous)
-
Method Summary
-
-
-
Constructor Detail
-
PooledSession
public PooledSession(SessionKey key, SessionHolder sessionHolder, KeyedObjectPool<SessionKey,SessionHolder> sessionPool, boolean transactional, boolean anonymous)
-
-
Method Detail
-
addSessionEventListener
public void addSessionEventListener(org.apache.activemq.jms.pool.PooledSessionEventListener listener)
-
isIgnoreClose
protected boolean isIgnoreClose()
-
setIgnoreClose
protected void setIgnoreClose(boolean ignoreClose)
-
close
public void close() throws JMSException
- Specified by:
close
in interfaceSession
- Throws:
JMSException
-
commit
public void commit() throws JMSException
- Specified by:
commit
in interfaceSession
- Specified by:
commit
in interfaceXASession
- Throws:
JMSException
-
createBytesMessage
public BytesMessage createBytesMessage() throws JMSException
- Specified by:
createBytesMessage
in interfaceSession
- Throws:
JMSException
-
createMapMessage
public MapMessage createMapMessage() throws JMSException
- Specified by:
createMapMessage
in interfaceSession
- Throws:
JMSException
-
createMessage
public Message createMessage() throws JMSException
- Specified by:
createMessage
in interfaceSession
- Throws:
JMSException
-
createObjectMessage
public ObjectMessage createObjectMessage() throws JMSException
- Specified by:
createObjectMessage
in interfaceSession
- Throws:
JMSException
-
createObjectMessage
public ObjectMessage createObjectMessage(Serializable serializable) throws JMSException
- Specified by:
createObjectMessage
in interfaceSession
- Throws:
JMSException
-
createQueue
public Queue createQueue(String s) throws JMSException
- Specified by:
createQueue
in interfaceQueueSession
- Specified by:
createQueue
in interfaceSession
- Throws:
JMSException
-
createStreamMessage
public StreamMessage createStreamMessage() throws JMSException
- Specified by:
createStreamMessage
in interfaceSession
- Throws:
JMSException
-
createTemporaryQueue
public TemporaryQueue createTemporaryQueue() throws JMSException
- Specified by:
createTemporaryQueue
in interfaceQueueSession
- Specified by:
createTemporaryQueue
in interfaceSession
- Throws:
JMSException
-
createTemporaryTopic
public TemporaryTopic createTemporaryTopic() throws JMSException
- Specified by:
createTemporaryTopic
in interfaceSession
- Specified by:
createTemporaryTopic
in interfaceTopicSession
- Throws:
JMSException
-
unsubscribe
public void unsubscribe(String s) throws JMSException
- Specified by:
unsubscribe
in interfaceSession
- Specified by:
unsubscribe
in interfaceTopicSession
- Throws:
JMSException
-
createTextMessage
public TextMessage createTextMessage() throws JMSException
- Specified by:
createTextMessage
in interfaceSession
- Throws:
JMSException
-
createTextMessage
public TextMessage createTextMessage(String s) throws JMSException
- Specified by:
createTextMessage
in interfaceSession
- Throws:
JMSException
-
createTopic
public Topic createTopic(String s) throws JMSException
- Specified by:
createTopic
in interfaceSession
- Specified by:
createTopic
in interfaceTopicSession
- Throws:
JMSException
-
getAcknowledgeMode
public int getAcknowledgeMode() throws JMSException
- Specified by:
getAcknowledgeMode
in interfaceSession
- Throws:
JMSException
-
getTransacted
public boolean getTransacted() throws JMSException
- Specified by:
getTransacted
in interfaceSession
- Specified by:
getTransacted
in interfaceXASession
- Throws:
JMSException
-
recover
public void recover() throws JMSException
- Specified by:
recover
in interfaceSession
- Throws:
JMSException
-
rollback
public void rollback() throws JMSException
- Specified by:
rollback
in interfaceSession
- Specified by:
rollback
in interfaceXASession
- Throws:
JMSException
-
getXAResource
public XAResource getXAResource()
- Specified by:
getXAResource
in interfaceXASession
-
getSession
public Session getSession()
- Specified by:
getSession
in interfaceXASession
-
run
public void run()
-
createBrowser
public QueueBrowser createBrowser(Queue queue) throws JMSException
- Specified by:
createBrowser
in interfaceQueueSession
- Specified by:
createBrowser
in interfaceSession
- Throws:
JMSException
-
createBrowser
public QueueBrowser createBrowser(Queue queue, String selector) throws JMSException
- Specified by:
createBrowser
in interfaceQueueSession
- Specified by:
createBrowser
in interfaceSession
- Throws:
JMSException
-
createConsumer
public MessageConsumer createConsumer(Destination destination) throws JMSException
- Specified by:
createConsumer
in interfaceSession
- Throws:
JMSException
-
createConsumer
public MessageConsumer createConsumer(Destination destination, String selector) throws JMSException
- Specified by:
createConsumer
in interfaceSession
- Throws:
JMSException
-
createConsumer
public MessageConsumer createConsumer(Destination destination, String selector, boolean noLocal) throws JMSException
- Specified by:
createConsumer
in interfaceSession
- Throws:
JMSException
-
createDurableSubscriber
public TopicSubscriber createDurableSubscriber(Topic topic, String selector) throws JMSException
- Specified by:
createDurableSubscriber
in interfaceSession
- Specified by:
createDurableSubscriber
in interfaceTopicSession
- Throws:
JMSException
-
createDurableSubscriber
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String selector, boolean noLocal) throws JMSException
- Specified by:
createDurableSubscriber
in interfaceSession
- Specified by:
createDurableSubscriber
in interfaceTopicSession
- Throws:
JMSException
-
getMessageListener
public MessageListener getMessageListener() throws JMSException
- Specified by:
getMessageListener
in interfaceSession
- Throws:
JMSException
-
setMessageListener
public void setMessageListener(MessageListener messageListener) throws JMSException
- Specified by:
setMessageListener
in interfaceSession
- Throws:
JMSException
-
createSubscriber
public TopicSubscriber createSubscriber(Topic topic) throws JMSException
- Specified by:
createSubscriber
in interfaceTopicSession
- Throws:
JMSException
-
createSubscriber
public TopicSubscriber createSubscriber(Topic topic, String selector, boolean local) throws JMSException
- Specified by:
createSubscriber
in interfaceTopicSession
- Throws:
JMSException
-
createReceiver
public QueueReceiver createReceiver(Queue queue) throws JMSException
- Specified by:
createReceiver
in interfaceQueueSession
- Throws:
JMSException
-
createReceiver
public QueueReceiver createReceiver(Queue queue, String selector) throws JMSException
- Specified by:
createReceiver
in interfaceQueueSession
- Throws:
JMSException
-
createProducer
public MessageProducer createProducer(Destination destination) throws JMSException
- Specified by:
createProducer
in interfaceSession
- Throws:
JMSException
-
createSender
public QueueSender createSender(Queue queue) throws JMSException
- Specified by:
createSender
in interfaceQueueSession
- Throws:
JMSException
-
createPublisher
public TopicPublisher createPublisher(Topic topic) throws JMSException
- Specified by:
createPublisher
in interfaceTopicSession
- Throws:
JMSException
-
getInternalSession
public Session getInternalSession() throws IllegalStateException
- Throws:
IllegalStateException
-
getMessageProducer
public MessageProducer getMessageProducer() throws JMSException
- Throws:
JMSException
-
getMessageProducer
public MessageProducer getMessageProducer(Destination destination) throws JMSException
- Throws:
JMSException
-
getQueueSender
public QueueSender getQueueSender() throws JMSException
- Throws:
JMSException
-
getQueueSender
public QueueSender getQueueSender(Queue destination) throws JMSException
- Throws:
JMSException
-
getTopicPublisher
public TopicPublisher getTopicPublisher() throws JMSException
- Throws:
JMSException
-
getTopicPublisher
public TopicPublisher getTopicPublisher(Topic destination) throws JMSException
- Throws:
JMSException
-
setIsXa
public void setIsXa(boolean isXa)
-
onConsumerClose
protected void onConsumerClose(MessageConsumer consumer)
Callback invoked when the consumer is closed. This is used to keep track of an explicit closed consumer created by this session, by which we know do not need to keep track of the consumer, as its already closed.- Parameters:
consumer
- the consumer which is being closed
-
-