MQSimpleConnectionManager
java.lang.Object com.ibm.mq.MQConnectionManager | | *- com.ibm.mq.MQSimpleConnectionManager
public class MQSimpleConnectionManager
implements MQConnectionManager (See topic "MQConnectionManager".)
An MQSimpleConnectionManager provides basic connection pooling functionality. You can use an MQSimpleConnectionManager either as the default Connection Manager, or as a parameter to an MQQueueManager constructor. When an MQQueueManager is constructed, the most-recently-used connection in the pool is used.
Connections are destroyed (by a separate thread) when they are unused for a specified period, or when there are more than a specified number of unused connections in the pool. You can specify the timeout period and the maximum number of unused connections.
Variables
- MODE_ACTIVE
- public static final int MODE_ACTIVE. See setActive.
- MODE_AUTO
- public static final int MODE_AUTO. See setActive.
- MODE_INACTIVE
- public static final int MODE_INACTIVE. See setActive.
Constructors
- MQSimpleConnectionManager
- public MQSimpleConnectionManager()
Constructs an MQSimpleConnectionManager.
Methods
- getActive
- public int getActive()
Gets the mode of the connection pool.
Returns
The current active mode of the connection pool, with one of the following values (see setActive):
MODE_ACTIVE
MODE_AUTO
MODE_INACTIVE
- getHighThreshold
- public int getHighThreshold ()
Returns the HighThreshold value.
- getTimeout
- public long getTimeout()
- setActive
- public void setActive(int mode)
Sets the active mode of the connection pool.
Parameters
- mode
- The required active mode of the connection pool. Valid values are:
- MODE_ACTIVE
- The connection pool is always active. When MQQueueManager.disconnect() is called, the underlying connection is pooled, and potentially reused the next time that an MQQueueManager object is constructed. Connections are destroyed by a separate thread if they are unused for longer than the Timeout period, or if the size of the pool exceeds HighThreshold.
- MODE_AUTO
- The connection pool is active while the Connection Manager is the default Connection Manager and there is at least one token in the set of MQPoolTokens held by MQEnvironment. This is the default mode.
- MODE_INACTIVE
- The connection pool is always inactive. When this mode is entered, the pool of connections to WebSphere MQ is cleared. When MQQueueManager.disconnect() is called, the connection that underlies any active MQQueueManager object is destroyed.
- setHighThreshold
- public void setHighThreshold(int threshold)
Sets the HighThreshold. If the number of unused connections in the pool exceeds this value, the oldest unused connection in the pool is destroyed.
Parameters
- threshold
- The maximum number of unused connections in the pool.
- setTimeout
- public void setTimeout(long timeout)
Sets the Timeout value, where connections that remain unused for this length of time are destroyed by a separate thread.
Parameters
- timeout
- The value of the timeout in milliseconds.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.