|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.objectpools.KeyedObjectPoolFactory
org.osesb.objectpools.JMSClientKeyedPoolFactory
public class JMSClientKeyedPoolFactory
This class is a factory for a pool of JMS clients, with different configurations (heterogeneous). The framewok jax-rpc clients are in the org.osesb.connectors.jms package.
This class is is a thread-safe singleton, so only one instance of JMSClientKeyedPoolFactory and its associated KeyedObjectPool instance will exist per class loader. Object pools of JMS clients are useful in multi-threaded environments, which require repeated access to multiple JMS client connections. Instead of repeatedly creating and closing JMS connections, clients call getObject() on a pool of JMS clients and returnObject() after a message has been sent or received. PooledJMSClientAccessHelper is a helper class for accessing pooled JMS clients. JMS client pools can include the following JMS clients, which are in the org.osesb.connectors.jms package.<key-pooled-jms-clients>
<pool-configuration>
<!-- an optional name for the pool -->
<poolName>JMS Connection Pool - MyProject</poolName>
<!-- display a pool heartbeat message every heartbeatInterval seconds -->
<heartbeatInterval>300</heartbeatInterval>
<!-- parameters that are specific to the pool implementation go here -->
<!-- these are the config properties for jakarta-commons-pooling -->
<!-- GenericObjectPool Config -->
<maxIdle></maxIdle>
<!-- No limit to the number of objects -->
<maxActive>-1</maxActive>
<maxWait>-1</maxWait>
<!-- Grow the pool when a borrowobject() fails -->
<whenExhaustedAction>2</whenExhaustedAction>
<testOnBorrow>false</testOnBorrow>
<testOnReturn>false</testOnReturn>
<testWhileIdle>false</testWhileIdle>
<!-- check for idle objects every 6 minutes -->
<timeBetweenEvictionRunsMillis>360000</timeBetweenEvictionRunsMillis>
<numTestsPerEvictionRun></numTestsPerEvictionRun>
<!-- evict objects idle more than 5 minutes -->
<minEvictableIdleTimeMillis>300000</minEvictableIdleTimeMillis>
<!-- display pool startup message -->
<displayStartupMessageFlag>true</displayStartupMessageFlag>
</pool-configuration>
<!-- Pooled client for sending messages to Siebel -->
<jms-configuration poolKey="siebel-inqueue">
<!-- the class that is pooled -->
<pooled-class>org.osesb.connectors.jms.JMSQueueSender</pooled-class>
<!-- for pooled object's, do not display the startup message -->
<displayStartupMessageFlag>false</displayStartupMessageFlag>
<!-- standard properties -->
<contextFactory>com.ibm.websphere.naming.WsnInitialContextFactory</contextFactory>
<!--<providerURL>iiop://localhost:2809</providerURL>-->
<queueConnectionFactory>was/jms/QueueConnectionFactory</queueConnectionFactory>
<queue>was/mq/siebelinqueue</queue>
<!--
<contextSecurityPrincipal>anonymous</contextSecurityPrincipal>
<contextSecurityCredentials>anonymous</contextSecurityCredentials>
-->
<debugFlag>true</debugFlag>
</jms-configuration>
<!-- Pooled client for sending synchronous request/reply messages to Siebel -->
<jms-configuration poolKey="siebel-inqueue-request-reply">
<!-- the class that is pooled -->
<pooled-class>org.osesb.connectors.jms.JMSQueueSender</pooled-class>
<!-- for pooled object's, do not display the startup message -->
<displayStartupMessageFlag>false</displayStartupMessageFlag>
<!-- standard properties -->
<contextFactory>com.ibm.websphere.naming.WsnInitialContextFactory</contextFactory>
<!--<providerURL>iiop://localhost:2809</providerURL>-->
<queueConnectionFactory>was/jms/QueueConnectionFactory</queueConnectionFactory>
<queue>was/mq/siebelinqueue</queue>
<!--
<contextSecurityPrincipal>anonymous</contextSecurityPrincipal>
<contextSecurityCredentials>anonymous</contextSecurityCredentials>
-->
<debugFlag>true</debugFlag>
<!-- synchronous request/reply interaction using JMS client sendSynchronousXXX methods -->
<synchronous-jms-configuration>
<!-- The Queue on which the reply is received. -->
<replyToQueue></replyToQueue>
<!-- The Topic on which the reply is received. -->
<replyToTopic></replyToTopic>
<!-- The destination on which the reply is received is given by an entry in -->
<!-- the pooled JMS configuration for the project. This is a pooled JMS receiver. -->
<replyToPoolKey>siebel-broker-reply-receiver</replyToPoolKey>
<!-- filter reply as correlationID = 'original message ID' -->
<!-- the sender of the reply must set the correlation ID in the message header -->
<filterOnCorrelationID>true</filterOnCorrelationID>
<!-- timeout in seconds, that a synchronous JMS client will wait for a reply message.
Must be between JMSClientConfiguration.MIN_SYNCH_JMS_TIMEOUT_SECONDS and JMSClientConfiguration.MAX_SYNCH_JMS_TIMEOUT_SECONDS-->
<replyTimeOutSeconds>10</replyTimeOutSeconds>
</synchronous-jms-configuration>
</jms-configuration>
<!-- Pooled receiver corresponding to the <synchronous-jms-configuration> content
model for poolKey 'siebel-inqueue-request-reply' -->
<jms-configuration poolKey="siebel-broker-reply-receiver">
<!-- the class that is pooled -->
<pooled-class>org.osesb.connectors.jms.JMSQueueReceiver</pooled-class>
<!-- for pooled object's, do not display the startup message -->
<displayStartupMessageFlag>false</displayStartupMessageFlag>
<!-- standard properties -->
<contextFactory>com.ibm.websphere.naming.WsnInitialContextFactory</contextFactory>
<!--<providerURL>iiop://localhost:2809</providerURL>-->
<queueConnectionFactory>was/jms/QueueConnectionFactory</queueConnectionFactory>
<queue>was/jms/siebelbrokerreply</queue>
<!--
<contextSecurityPrincipal>anonymous</contextSecurityPrincipal>
<contextSecurityCredentials>anonymous</contextSecurityCredentials>
-->
<debugFlag>true</debugFlag>
</jms-configuration>
<!-- Pooled client for sending messages to IVR -->
<jms-configuration poolKey="ivr-inqueue">
<!-- the class that is pooled -->
<pooled-class>org.osesb.connectors.jms.JMSQueueSender</pooled-class>
<!-- for pooled object's, do not display the startup message -->
<displayStartupMessageFlag>false</displayStartupMessageFlag>
<!-- standard properties -->
<contextFactory>com.ibm.websphere.naming.WsnInitialContextFactory</contextFactory>
<!--<providerURL>iiop://localhost:2809</providerURL>-->
<queueConnectionFactory>was/jms/QueueConnectionFactory</queueConnectionFactory>
<queue>was/mq/ivrinqueue</queue>
<!--
<contextSecurityPrincipal>anonymous</contextSecurityPrincipal>
<contextSecurityCredentials>anonymous</contextSecurityCredentials>
-->
<debugFlag>true</debugFlag>
</jms-configuration>
</key-pooled-jms-clients>
| Nested Class Summary | |
|---|---|
protected static class |
JMSClientKeyedPoolFactory.JMSClientPoolableObjectFactory
Inner class that implements org.apache.commons.pool.KeyedPoolableObjectFactory, which is instantiated by the enclosing class and passed to GenericObjectPool's constructor. |
| Field Summary | |
|---|---|
protected static KeyedObjectPoolConfiguration |
keyedObjectPoolConfiguration
The pool configuration as a whole including the ObjectPoolConfiguration and the pooled object configuration(s). |
protected static JMSClientKeyedPoolFactory |
poolFactoryInstance
Singleton pattern - thread-safe construction. |
protected static KeyedObjectPool |
poolInstance
The instance of the objectpool we will create. |
protected static java.lang.String |
thisClassName
The full name of this class |
| Fields inherited from class org.osesb.objectpools.KeyedObjectPoolFactory |
|---|
log |
| Constructor Summary | |
|---|---|
protected |
JMSClientKeyedPoolFactory()
Singleton pattern - cannot be instantiated directly. |
| Method Summary | |
|---|---|
static KeyedObjectPoolFactory |
getInstance()
Singleton pattern - - returns the instance of this class. |
KeyedObjectPoolConfiguration |
getKeyedObjectPoolConfiguration()
Return the pool configuration as a whole including the ObjectPoolConfiguration and the pooled object configuration(s). |
KeyedObjectPool |
getPool()
Returns the object pool instance. |
static void |
main(java.lang.String[] args)
Main method for testing and sandboxing. |
void |
resetPoolInstance()
Close the pool and reset the poolInstance. |
| Methods inherited from class org.osesb.objectpools.KeyedObjectPoolFactory |
|---|
getPoolConfig |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static KeyedObjectPool poolInstance
protected static KeyedObjectPoolConfiguration keyedObjectPoolConfiguration
protected static java.lang.String thisClassName
protected static JMSClientKeyedPoolFactory poolFactoryInstance
| Constructor Detail |
|---|
protected JMSClientKeyedPoolFactory()
| Method Detail |
|---|
public static KeyedObjectPoolFactory getInstance()
public KeyedObjectPool getPool()
throws java.lang.Exception
getPool in class KeyedObjectPoolFactoryjava.lang.Exceptionpublic KeyedObjectPoolConfiguration getKeyedObjectPoolConfiguration()
getKeyedObjectPoolConfiguration in class KeyedObjectPoolFactorypublic void resetPoolInstance()
resetPoolInstance in class KeyedObjectPoolFactorypublic static void main(java.lang.String[] args)
args -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||