public class PooledConnection extends Object implements TopicConnection, QueueConnection
Connection
which is-a TopicConnection
and
QueueConnection
which is pooled and on close()
will return
its reference to the ConnectionPool backing it.
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 exampleModifier and Type | Field and Description |
---|---|
protected ConnectionPool |
pool |
Constructor and Description |
---|
PooledConnection(ConnectionPool pool)
Creates a new PooledConnection instance that uses the given ConnectionPool to create
and manage its resources.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertNotClosed() |
protected void |
cleanupAllLoanedSessions()
The PooledSession tracks all Sessions that it created and now we close them.
|
protected void |
cleanupConnectionTemporaryDestinations()
Remove all of the temporary destinations created for this connection.
|
void |
close() |
ConnectionConsumer |
createConnectionConsumer(Destination destination,
String selector,
ServerSessionPool serverSessionPool,
int maxMessages) |
ConnectionConsumer |
createConnectionConsumer(Queue queue,
String selector,
ServerSessionPool serverSessionPool,
int maxMessages) |
ConnectionConsumer |
createConnectionConsumer(Topic topic,
String s,
ServerSessionPool serverSessionPool,
int maxMessages) |
ConnectionConsumer |
createDurableConnectionConsumer(Topic topic,
String selector,
String s1,
ServerSessionPool serverSessionPool,
int i) |
QueueSession |
createQueueSession(boolean transacted,
int ackMode) |
Session |
createSession(boolean transacted,
int ackMode) |
protected Session |
createSession(SessionKey key) |
TopicSession |
createTopicSession(boolean transacted,
int ackMode) |
String |
getClientID() |
Connection |
getConnection() |
ExceptionListener |
getExceptionListener() |
ConnectionMetaData |
getMetaData() |
int |
getNumActiveSessions() |
int |
getNumSessions() |
int |
getNumtIdleSessions() |
PooledConnection |
newInstance()
Factory method to create a new instance.
|
void |
onSessionClosed(PooledSession session)
Called when the PooledSession is closed.
|
void |
onTemporaryQueueCreate(TemporaryQueue tempQueue)
Called on successful creation of a new TemporaryQueue.
|
void |
onTemporaryTopicCreate(TemporaryTopic tempTopic)
Called on successful creation of a new TemporaryTopic.
|
void |
setClientID(String clientID) |
void |
setExceptionListener(ExceptionListener exceptionListener) |
void |
start() |
void |
stop() |
String |
toString() |
protected ConnectionPool pool
public PooledConnection(ConnectionPool pool)
pool
- The connection and pool manager backing this proxy connection object.public PooledConnection newInstance()
public void close() throws JMSException
close
in interface Connection
JMSException
public void start() throws JMSException
start
in interface Connection
JMSException
public void stop() throws JMSException
stop
in interface Connection
JMSException
public ConnectionConsumer createConnectionConsumer(Destination destination, String selector, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException
createConnectionConsumer
in interface Connection
JMSException
public ConnectionConsumer createConnectionConsumer(Topic topic, String s, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException
createConnectionConsumer
in interface TopicConnection
JMSException
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String selector, String s1, ServerSessionPool serverSessionPool, int i) throws JMSException
createDurableConnectionConsumer
in interface Connection
createDurableConnectionConsumer
in interface TopicConnection
JMSException
public String getClientID() throws JMSException
getClientID
in interface Connection
JMSException
public ExceptionListener getExceptionListener() throws JMSException
getExceptionListener
in interface Connection
JMSException
public ConnectionMetaData getMetaData() throws JMSException
getMetaData
in interface Connection
JMSException
public void setExceptionListener(ExceptionListener exceptionListener) throws JMSException
setExceptionListener
in interface Connection
JMSException
public void setClientID(String clientID) throws JMSException
setClientID
in interface Connection
JMSException
public ConnectionConsumer createConnectionConsumer(Queue queue, String selector, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException
createConnectionConsumer
in interface QueueConnection
JMSException
public QueueSession createQueueSession(boolean transacted, int ackMode) throws JMSException
createQueueSession
in interface QueueConnection
JMSException
public TopicSession createTopicSession(boolean transacted, int ackMode) throws JMSException
createTopicSession
in interface TopicConnection
JMSException
public Session createSession(boolean transacted, int ackMode) throws JMSException
createSession
in interface Connection
JMSException
public void onTemporaryQueueCreate(TemporaryQueue tempQueue)
tempQueue
- The TemporaryQueue just created.public void onTemporaryTopicCreate(TemporaryTopic tempTopic)
tempTopic
- The TemporaryTopic just created.public void onSessionClosed(PooledSession session)
session
- The PooledSession that has been closed.public Connection getConnection() throws JMSException
JMSException
protected void assertNotClosed() throws IllegalStateException
IllegalStateException
protected Session createSession(SessionKey key) throws JMSException
JMSException
protected void cleanupConnectionTemporaryDestinations()
protected void cleanupAllLoanedSessions()
public int getNumSessions()
public int getNumActiveSessions()
public int getNumtIdleSessions()
Copyright © 2005–2017 FuseSource, Corp.. All rights reserved.