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 example| Modifier 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 ConnectionJMSExceptionpublic void start() throws JMSException
start in interface ConnectionJMSExceptionpublic void stop() throws JMSException
stop in interface ConnectionJMSExceptionpublic ConnectionConsumer createConnectionConsumer(Destination destination, String selector, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException
createConnectionConsumer in interface ConnectionJMSExceptionpublic ConnectionConsumer createConnectionConsumer(Topic topic, String s, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException
createConnectionConsumer in interface TopicConnectionJMSExceptionpublic ConnectionConsumer createDurableConnectionConsumer(Topic topic, String selector, String s1, ServerSessionPool serverSessionPool, int i) throws JMSException
createDurableConnectionConsumer in interface ConnectioncreateDurableConnectionConsumer in interface TopicConnectionJMSExceptionpublic String getClientID() throws JMSException
getClientID in interface ConnectionJMSExceptionpublic ExceptionListener getExceptionListener() throws JMSException
getExceptionListener in interface ConnectionJMSExceptionpublic ConnectionMetaData getMetaData() throws JMSException
getMetaData in interface ConnectionJMSExceptionpublic void setExceptionListener(ExceptionListener exceptionListener) throws JMSException
setExceptionListener in interface ConnectionJMSExceptionpublic void setClientID(String clientID) throws JMSException
setClientID in interface ConnectionJMSExceptionpublic ConnectionConsumer createConnectionConsumer(Queue queue, String selector, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException
createConnectionConsumer in interface QueueConnectionJMSExceptionpublic QueueSession createQueueSession(boolean transacted, int ackMode) throws JMSException
createQueueSession in interface QueueConnectionJMSExceptionpublic TopicSession createTopicSession(boolean transacted, int ackMode) throws JMSException
createTopicSession in interface TopicConnectionJMSExceptionpublic Session createSession(boolean transacted, int ackMode) throws JMSException
createSession in interface ConnectionJMSExceptionpublic 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
JMSExceptionprotected void assertNotClosed() throws IllegalStateException
IllegalStateExceptionprotected Session createSession(SessionKey key) throws JMSException
JMSExceptionprotected void cleanupConnectionTemporaryDestinations()
protected void cleanupAllLoanedSessions()
public int getNumSessions()
public int getNumActiveSessions()
public int getNumtIdleSessions()
Copyright © 2005–2016 FuseSource, Corp.. All rights reserved.