com.waveset.adapter
Class ResourceConnectionManager

java.lang.Object
  extended bycom.waveset.adapter.ResourceConnectionManager

public class ResourceConnectionManager
extends java.lang.Object

Manages connection pools for resources. The pools are maintained as a list and are mapped one-to-one to a resource. Only resources who use the ResourceConnectionManager are allocated connection pools. A connection is requested by the following example: ResourceConnectionManager connMgr = ResourceConnectionManager.getInstance(); ResourceConnection conn = connMgr.getConnection(resource, type, args); The connection is released by: connMgr.releaseConnection(resource, conn);


Field Summary
protected static Trace _trace
           
static java.lang.String code_id
           
 
Method Summary
 ResourceConnection getConnection(Resource resource, java.util.HashMap args)
           
 ResourceConnection getConnection(Resource resource, java.util.HashMap args, long timeout)
           
 ResourceConnection getConnection(Resource resource, java.lang.String type, java.util.HashMap args)
           
 ResourceConnection getConnection(Resource resource, java.lang.String type, java.util.HashMap args, long timeout)
           
 ResourceConnection getConnection(Resource resource, java.lang.String type, java.util.HashMap args, long timeout, boolean pooled)
           
 ResourceConnection getConnection(Resource resource, java.lang.String type, java.util.HashMap args, long timeout, boolean pooled, java.lang.String poolType)
          Retrieves the pool for the target resource.
 ResourceConnection getConnection(Resource resource, java.lang.String type, java.util.HashMap args, java.lang.String poolType)
           
static ResourceConnectionManager getInstance()
          The public interface.
 void reapConnections()
          Called by ResourceConnectionReaper.
 void releaseConnection(Resource resource, ResourceConnection connection)
           
 void releaseConnection(Resource resource, ResourceConnection connection, boolean force)
          Retrieves the pool for the specified resource and invokes the releaseConnection() method for the pool object to release the specified connection.
 void shutdown()
          Shuts down the connection pools and reaper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

_trace

protected static Trace _trace
Method Detail

getInstance

public static ResourceConnectionManager getInstance()
The public interface. Creates an singleton instance if not already created.


getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.lang.String type,
                                        java.util.HashMap args,
                                        long timeout,
                                        boolean pooled,
                                        java.lang.String poolType)
                                 throws java.lang.IllegalArgumentException,
                                        WavesetException
Retrieves the pool for the target resource. The getConnection() method of the pool object is invoked to retrieve the connection.

Throws:
java.lang.IllegalArgumentException
WavesetException

getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.lang.String type,
                                        java.util.HashMap args,
                                        long timeout,
                                        boolean pooled)
                                 throws java.lang.IllegalArgumentException,
                                        WavesetException
Throws:
java.lang.IllegalArgumentException
WavesetException

getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.lang.String type,
                                        java.util.HashMap args,
                                        long timeout)
                                 throws WavesetException
Throws:
WavesetException

getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.lang.String type,
                                        java.util.HashMap args)
                                 throws WavesetException
Throws:
WavesetException

getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.lang.String type,
                                        java.util.HashMap args,
                                        java.lang.String poolType)
                                 throws WavesetException
Throws:
WavesetException

getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.util.HashMap args,
                                        long timeout)
                                 throws WavesetException
Throws:
WavesetException

getConnection

public ResourceConnection getConnection(Resource resource,
                                        java.util.HashMap args)
                                 throws WavesetException
Throws:
WavesetException

releaseConnection

public void releaseConnection(Resource resource,
                              ResourceConnection connection,
                              boolean force)
                       throws java.lang.IllegalArgumentException,
                              WavesetException
Retrieves the pool for the specified resource and invokes the releaseConnection() method for the pool object to release the specified connection.

Throws:
java.lang.IllegalArgumentException
WavesetException

releaseConnection

public void releaseConnection(Resource resource,
                              ResourceConnection connection)
                       throws java.lang.IllegalArgumentException,
                              WavesetException
Throws:
java.lang.IllegalArgumentException
WavesetException

reapConnections

public void reapConnections()
Called by ResourceConnectionReaper. Invokes the reaper method for each pool in the list. All connections identified by the pools are disconnected and released. Also, releases any empty pool from the pool list.


shutdown

public void shutdown()
Shuts down the connection pools and reaper.