org.osesb.objectpools
Class ClientGatewayKeyedPoolFactory

java.lang.Object
  extended by org.osesb.objectpools.KeyedObjectPoolFactory
      extended by org.osesb.objectpools.ClientGatewayKeyedPoolFactory

public class ClientGatewayKeyedPoolFactory
extends KeyedObjectPoolFactory

This class is a factory for a object pool of org.osesb.msgrouting.ClientGateway(s), with different configurations (heterogeneous).

ClientGateway(s) facilitate communication with broker end points such as JMS Queues and web services. ClientGateway is used to hide messaging infrastructure from client applications. Client applications are not aware of target destinations, the message transport, or how a request is fulfilled. Initiating applications merely send a message, and possibly, receive a response.

For multi-threaded environments or for any situation where an application client needs to send multiple messages to osESB, use a pool of ClientGateway(s) to send messages and possibly receive replies. This approach may eliminate the need for the client to correlate multiple request/reply interactions.


Nested Class Summary
protected static class ClientGatewayKeyedPoolFactory.ClientGatewayPoolableObjectFactory
          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 ClientGatewayKeyedPoolFactory 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 ClientGatewayKeyedPoolFactory()
          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

poolInstance

protected static KeyedObjectPool poolInstance
The instance of the objectpool we will create.


keyedObjectPoolConfiguration

protected static KeyedObjectPoolConfiguration keyedObjectPoolConfiguration
The pool configuration as a whole including the ObjectPoolConfiguration and the pooled object configuration(s).


thisClassName

protected static java.lang.String thisClassName
The full name of this class


poolFactoryInstance

protected static ClientGatewayKeyedPoolFactory poolFactoryInstance
Singleton pattern - thread-safe construction.

Constructor Detail

ClientGatewayKeyedPoolFactory

protected ClientGatewayKeyedPoolFactory()
Singleton pattern - cannot be instantiated directly.

Method Detail

getInstance

public static KeyedObjectPoolFactory getInstance()
Singleton pattern - - returns the instance of this class. Callers can then call getPool() to get the object pool.

Returns:
the singleton instance of this class.

getPool

public KeyedObjectPool getPool()
                        throws java.lang.Exception
Returns the object pool instance.

There is no default configuration file for a ClientGateway pool, so load the ClientGatewayKeyedPoolFactory configuration file according to the following plan:

  1. The configuration file given by the System property named ObjectPoolConstants.CLIENTGATEWAYKEYEDPOOLCONFIGFILE_PROPERTY.
  2. The configuration file given by the ObjectPoolConstants.CLIENTGATEWAYKEYEDPOOLCONFIGFILE_PROPERTY entry in a properties file named ObjectPoolConstants.OBJECTPOOLCONFIGURATIONS_PROPERTIES_FILE.

Specified by:
getPool in class KeyedObjectPoolFactory
Returns:
an instance of the heterogeneous object pool.
Throws:
java.lang.Exception

getKeyedObjectPoolConfiguration

public KeyedObjectPoolConfiguration getKeyedObjectPoolConfiguration()
Return the pool configuration as a whole including the ObjectPoolConfiguration and the pooled object configuration(s). Note that keyedObjectPoolConfiguration is null until getPool() is invoked on the concrete implementation of this class.

Specified by:
getKeyedObjectPoolConfiguration in class KeyedObjectPoolFactory

resetPoolInstance

public void resetPoolInstance()
Close the pool and reset the poolInstance.

Specified by:
resetPoolInstance in class KeyedObjectPoolFactory

main

public static void main(java.lang.String[] args)
Main method for testing and sandboxing.

Parameters:
args -