public class PooledConnectionFactory extends Object implements ConnectionFactory
Modifier and Type | Field and Description |
---|---|
(package private) ConnectionFactory |
cf
The underlying ConnectionFactory
|
(package private) int |
maxFreeConnections
The maximum number of free connections for an identity in the pool.
|
(package private) ConnectionPool |
pool
The pool of connections
|
Constructor and Description |
---|
PooledConnectionFactory(ConnectionFactory cf)
Creates a new pool for the specified ConnectionFactory.
|
PooledConnectionFactory(ConnectionFactory cf,
int maxFreeConnections)
Creates a new pool for the specified ConnectionFactory.
|
Modifier and Type | Method and Description |
---|---|
Connection |
createConnection()
API method, creates a connection with the default user identity.
|
Connection |
createConnection(String name,
String password)
API method, creates a connection with the specified user identity.
|
protected ConnectionPool |
createConnectionPool(int maxFreeConnections) |
JMSContext |
createContext() |
JMSContext |
createContext(int sessionMode) |
JMSContext |
createContext(String userName,
String password) |
JMSContext |
createContext(String userName,
String password,
int sessionMode) |
(package private) void |
free(PooledConnection cnx) |
ConnectionFactory |
getConnectionFactory()
Returns the underlying ConnectionFactory used to create the connections.
|
int |
getMaxFreeConnections()
Returns the maximum number of free connections for an identity in the pool.
|
void |
setMaxFreeConnections(int maxFreeConnections)
Sets the maximum number of free connections for an identity in the pool.
|
ConnectionFactory cf
ConnectionPool pool
int maxFreeConnections
public PooledConnectionFactory(ConnectionFactory cf)
cf
- The ConnectionFactory used to really create the connections.public PooledConnectionFactory(ConnectionFactory cf, int maxFreeConnections)
cf
- The ConnectionFactory used to really create the connections.maxFreeConnections
- The maximum number of free connections for an identity in the pool.public ConnectionFactory getConnectionFactory()
public int getMaxFreeConnections()
public void setMaxFreeConnections(int maxFreeConnections)
maxFreeConnections
- the maximum number of free connections to setpublic Connection createConnection() throws JMSException
createConnection
in interface ConnectionFactory
JMSSecurityException
- If the default identification is incorrect.IllegalStateException
- If the server is not listening.JMSException
ConnectionFactory.createConnection()
public Connection createConnection(String name, String password) throws JMSException
createConnection
in interface ConnectionFactory
name
- the caller's user name.password
- the caller's password.JMSSecurityException
- If the user identification is incorrect.IllegalStateException
- If the server is not listening.JMSException
ConnectionFactory.createConnection(String, String)
void free(PooledConnection cnx) throws JMSException
cnx
- JMSException
protected ConnectionPool createConnectionPool(int maxFreeConnections)
maxFreeConnections
- The maximum number of free connections for an identity in the pool.public JMSContext createContext()
public JMSContext createContext(String userName, String password)
public JMSContext createContext(String userName, String password, int sessionMode)
public JMSContext createContext(int sessionMode)
Copyright © 2013 ScalAgent D.T.. All Rights Reserved.