org.apache.aries.transaction.jms.internal
Class PooledConnection
java.lang.Object
org.apache.aries.transaction.jms.internal.PooledConnection
- All Implemented Interfaces:
- javax.jms.Connection, javax.jms.QueueConnection, javax.jms.TopicConnection
public class PooledConnection
- extends Object
- implements javax.jms.TopicConnection, javax.jms.QueueConnection
Represents a proxy Connection which is-a TopicConnection and
QueueConnection which is pooled and on close() will return
itself to the sessionPool.
NOTE this implementation is only intended for use when sending
messages. It does not deal with pooling of consumers; for that look at a
library like Jencks such as in this example
|
Method Summary |
protected void |
assertNotClosed()
|
protected void |
cleanupConnectionTemporaryDestinations()
Remove all of the temporary destinations created for this connection. |
void |
close()
|
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Destination destination,
String selector,
javax.jms.ServerSessionPool serverSessionPool,
int maxMessages)
|
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Queue queue,
String selector,
javax.jms.ServerSessionPool serverSessionPool,
int maxMessages)
|
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Topic topic,
String s,
javax.jms.ServerSessionPool serverSessionPool,
int maxMessages)
|
javax.jms.ConnectionConsumer |
createDurableConnectionConsumer(javax.jms.Topic topic,
String selector,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
|
javax.jms.QueueSession |
createQueueSession(boolean transacted,
int ackMode)
|
javax.jms.Session |
createSession(boolean transacted,
int ackMode)
|
protected javax.jms.Session |
createSession(SessionKey key)
|
javax.jms.TopicSession |
createTopicSession(boolean transacted,
int ackMode)
|
String |
getClientID()
|
javax.jms.Connection |
getConnection()
|
javax.jms.ExceptionListener |
getExceptionListener()
|
javax.jms.ConnectionMetaData |
getMetaData()
|
PooledConnection |
newInstance()
Factory method to create a new instance. |
void |
setClientID(String clientID)
|
void |
setExceptionListener(javax.jms.ExceptionListener exceptionListener)
|
void |
start()
|
void |
stop()
|
String |
toString()
|
PooledConnection
public PooledConnection(ConnectionPool pool)
newInstance
public PooledConnection newInstance()
- Factory method to create a new instance.
close
public void close()
throws javax.jms.JMSException
- Specified by:
close in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
start
public void start()
throws javax.jms.JMSException
- Specified by:
start in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
stop
public void stop()
throws javax.jms.JMSException
- Specified by:
stop in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination,
String selector,
javax.jms.ServerSessionPool serverSessionPool,
int maxMessages)
throws javax.jms.JMSException
- Specified by:
createConnectionConsumer in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Topic topic,
String s,
javax.jms.ServerSessionPool serverSessionPool,
int maxMessages)
throws javax.jms.JMSException
- Specified by:
createConnectionConsumer in interface javax.jms.TopicConnection
- Throws:
javax.jms.JMSException
createDurableConnectionConsumer
public javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
String selector,
String s1,
javax.jms.ServerSessionPool serverSessionPool,
int i)
throws javax.jms.JMSException
- Specified by:
createDurableConnectionConsumer in interface javax.jms.Connection- Specified by:
createDurableConnectionConsumer in interface javax.jms.TopicConnection
- Throws:
javax.jms.JMSException
getClientID
public String getClientID()
throws javax.jms.JMSException
- Specified by:
getClientID in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
getExceptionListener
public javax.jms.ExceptionListener getExceptionListener()
throws javax.jms.JMSException
- Specified by:
getExceptionListener in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
getMetaData
public javax.jms.ConnectionMetaData getMetaData()
throws javax.jms.JMSException
- Specified by:
getMetaData in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
setExceptionListener
public void setExceptionListener(javax.jms.ExceptionListener exceptionListener)
throws javax.jms.JMSException
- Specified by:
setExceptionListener in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
setClientID
public void setClientID(String clientID)
throws javax.jms.JMSException
- Specified by:
setClientID in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
createConnectionConsumer
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Queue queue,
String selector,
javax.jms.ServerSessionPool serverSessionPool,
int maxMessages)
throws javax.jms.JMSException
- Specified by:
createConnectionConsumer in interface javax.jms.QueueConnection
- Throws:
javax.jms.JMSException
createQueueSession
public javax.jms.QueueSession createQueueSession(boolean transacted,
int ackMode)
throws javax.jms.JMSException
- Specified by:
createQueueSession in interface javax.jms.QueueConnection
- Throws:
javax.jms.JMSException
createTopicSession
public javax.jms.TopicSession createTopicSession(boolean transacted,
int ackMode)
throws javax.jms.JMSException
- Specified by:
createTopicSession in interface javax.jms.TopicConnection
- Throws:
javax.jms.JMSException
createSession
public javax.jms.Session createSession(boolean transacted,
int ackMode)
throws javax.jms.JMSException
- Specified by:
createSession in interface javax.jms.Connection
- Throws:
javax.jms.JMSException
getConnection
public javax.jms.Connection getConnection()
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
assertNotClosed
protected void assertNotClosed()
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
createSession
protected javax.jms.Session createSession(SessionKey key)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
toString
public String toString()
- Overrides:
toString in class Object
cleanupConnectionTemporaryDestinations
protected void cleanupConnectionTemporaryDestinations()
- Remove all of the temporary destinations created for this connection.
This is important since the underlying connection may be reused over a
long period of time, accumulating all of the temporary destinations from
each use. However, from the perspective of the lifecycle from the
client's view, close() closes the connection and, therefore, deletes all
of the temporary destinations created.
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.