Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.0.0)

E10653-01

oracle.jbo.server
Class OCIConnectionPoolManagerImpl

java.lang.Object
  extended by oracle.jbo.pool.ResourcePoolManager
      extended by oracle.jbo.server.OCIConnectionPoolManagerImpl
All Implemented Interfaces:
ConnectionPoolManager

public class OCIConnectionPoolManagerImpl
extends ResourcePoolManager
implements ConnectionPoolManager

Manages a collection of oracle.jdbc.pool.OracleOCIConnectionPool instances.

The OCIConnectionPoolManagerImpl acquires and releases JDBC connections from an OracleOCIConnectionPool. This pool manager should be used if the application requires JDBC/OCI features like middle tier authentication through proxy connections. Proxy authentication may be enabled with the following steps:

1. Grant "connect through" priveleges on the Oracle database to the proxied used. For example, if DB user mary is to use the authenticated credentials of DB user john then the following must be granted to mary:

      alter user mary grant connect through john; 
   

2. Specify the proxy properties in the info properties that are passed to getConnection(String,String,Properties,String,String). Please see the OCI/JDBC application developer's guide for more information about different proxy types and their required properties.

Proxy properties may be passed from a BC4J client to getConnection by implementing a EnvInfoProvider and declaring it to the framework.

In order to use the OCIConnectionPoolManagerImpl you must first declare it to the framework using a framework property. For example:

jbo.ConnectionPoolManager=oracle.jbo.server.OCIConnectionPoolManagerImpl

Please see ConnectionPoolManager for more information about the ConnectionPoolManager interface.


Field Summary
 
Fields inherited from class oracle.jbo.pool.ResourcePoolManager
mLock
 
Constructor Summary
OCIConnectionPoolManagerImpl()
          Constructor
 
Method Summary
 void addConnection(java.lang.String poolKey, java.sql.Connection connection)
          Adds a connection to a connection pool.
protected  void createPoolMonitor()
           
 java.lang.String generatePoolKey(java.lang.String url, java.util.Properties info)
          Generates a unique pool identifier (poolKey) for the specified JDBC URL and JDBC driver properties.
 java.lang.String generatePoolKey(java.lang.String url, java.lang.String user, java.lang.String password)
          Generates a unique pool identifier (poolKey) for the specified JDBC URL and JDBC driver properties.
 java.sql.Connection getConnection(java.lang.String poolKey, java.lang.String url, java.util.Properties info, java.lang.String user, java.lang.String password)
          Returns a pooled connection from the specified target pool.
 java.sql.Connection getConnectionForInternalUse(java.lang.String connectionPoolKey, java.lang.String url, java.util.Properties info, java.lang.String user, java.lang.String password)
          Returns a pooled connection from the specified target pool.
 int getInitPoolSize()
          Returns the initial pool size for connection pools that are managed by this connection pool manager.
 int getMaxPoolSize()
          Returns the maximum pool size for connection pools that are managed by this connection pool manager.
protected  int getMonitorSleepInterval()
          Returns the interval in milliseconds for which the monitor daemon should sleep between wakeup requests.
 void removeConnection(java.lang.String poolKey, java.sql.Connection connection)
          Removes a pooled connection from a connection pool.
 void returnConnection(java.lang.String poolKey, java.sql.Connection connection)
          Returns a pooled connection to a connection pool.
 void returnConnection(java.lang.String poolKey, java.sql.Connection connection, java.util.Properties info)
          Returns a pooled connection to a connection pool.
 void returnConnectionForInternalUse(java.lang.String poolKey, java.sql.Connection connection, java.util.Properties info)
          Returns a pooled connection to a connection pool.
 
Methods inherited from class oracle.jbo.pool.ResourcePoolManager
addResourcePool, classLoaderShuttingDown, destroy, getManagerInstance, getProperty, getResourcePool, getResourcePoolKeys, getResourcePools, getResourcePoolTimer, removePoolMonitor, removeResourcePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OCIConnectionPoolManagerImpl

public OCIConnectionPoolManagerImpl()
Constructor

Method Detail

getConnection

public java.sql.Connection getConnection(java.lang.String poolKey,
                                         java.lang.String url,
                                         java.util.Properties info,
                                         java.lang.String user,
                                         java.lang.String password)
Description copied from interface: ConnectionPoolManager
Returns a pooled connection from the specified target pool.

Specified by:
getConnection in interface ConnectionPoolManager
Parameters:
poolKey - a unique identifier for the target connection pool.
url - the JDBC url that will be used to create connections in this pool.
info - the JDBC properties that will be used to create connections in this pool.
user - the username that will be used for database authentication.
password - the password that will be used for database authentication.
See Also:
ConnectionPoolManager.generatePoolKey(String, Properties)

getConnectionForInternalUse

public java.sql.Connection getConnectionForInternalUse(java.lang.String connectionPoolKey,
                                                       java.lang.String url,
                                                       java.util.Properties info,
                                                       java.lang.String user,
                                                       java.lang.String password)
Description copied from interface: ConnectionPoolManager
Returns a pooled connection from the specified target pool. This method is invoked when the BC4J framework requires a JDBC connection instance for internal use. The method is provided for applications with special handling requirements for internal connections. Internal connections may be required by BC4J to support the failover and spill to disk features of the BC4J framework. Most applications may delegate the implementation of this method to ConnectionPoolManager.getConnection(String, String, Properties, String, String)

Specified by:
getConnectionForInternalUse in interface ConnectionPoolManager
Parameters:
connectionPoolKey - a unique identifier for the target connection pool.
url - the JDBC url that will be used to create connections in this pool.
info - the JDBC properties that will be used to create connections in this pool.
user - the username that will be used for database authentication.
password - the password that will be used for database authentication.
See Also:
ConnectionPoolManager.generatePoolKey(String, Properties)

addConnection

public void addConnection(java.lang.String poolKey,
                          java.sql.Connection connection)
Description copied from interface: ConnectionPoolManager
Adds a connection to a connection pool. The poolKey is used by the connection pool manager to identify the target connection pool.

The implementation of this method should not return the connection to the pool after the connection has been added, because the invoking object still holds a reference to that connection. Instead, it is recommended that returning the new connection be the responsibility of of the object that owns the initial reference to the connection.

Specified by:
addConnection in interface ConnectionPoolManager
Parameters:
poolKey - a unique identifier for the target connection pool.
connection - the connection that should be checked in.
See Also:
ConnectionPoolManager.returnConnection(String, Connection), ConnectionPoolManager.generatePoolKey(String, Properties)

returnConnection

public void returnConnection(java.lang.String poolKey,
                             java.sql.Connection connection)
Description copied from interface: ConnectionPoolManager
Returns a pooled connection to a connection pool. The poolKey is used by the connection pool manager to identify the target connection pool.

The implementation of this operation should ensure that the returned connection does in fact belong to the specified connection pool.

Specified by:
returnConnection in interface ConnectionPoolManager
Parameters:
poolKey - a unique identifier for the target connection pool.
connection - the connection that should be checked in.
See Also:
ConnectionPoolManager.generatePoolKey(String, Properties)

returnConnection

public void returnConnection(java.lang.String poolKey,
                             java.sql.Connection connection,
                             java.util.Properties info)
Description copied from interface: ConnectionPoolManager
Returns a pooled connection to a connection pool. The poolKey is used by the connection pool manager to identify the target connection pool.

The implementation of this operation should ensure that the returned connection does in fact belong to the specified connection pool.

The properties object that is passed to return connection may be used by custom connection pool managers that require the original JDBC context to return the connection to the appropriate pool.

Specified by:
returnConnection in interface ConnectionPoolManager
Parameters:
poolKey - a unique identifier for the target connection pool.
connection - the connection that should be checked in.
info - the JDBC context that was used when the connection was acquired.
See Also:
ConnectionPoolManager.generatePoolKey(String, Properties)

returnConnectionForInternalUse

public void returnConnectionForInternalUse(java.lang.String poolKey,
                                           java.sql.Connection connection,
                                           java.util.Properties info)
Description copied from interface: ConnectionPoolManager
Returns a pooled connection to a connection pool. The poolKey is used by the connection pool manager to identify the target connection pool.

The implementation of this operation should ensure that the returned connection does in fact belong to the specified connection pool.

The properties object that is passed to return connection may be used by custom connection pool managers that require the original JDBC context to return the connection to the appropriate pool.

This method is invoked when the BC4J framework is releasing a JDBC connection instance which was used internally. The method is provided for applications with special handling requirements for internal connections. Internal connections may be required by BC4J to support the failover and spill to disk features of the BC4J framework. Most applications may delegate the implementation of this method to ConnectionPoolManager.returnConnection(String, Connection, Properties).

Specified by:
returnConnectionForInternalUse in interface ConnectionPoolManager
Parameters:
poolKey - a unique identifier for the target connection pool.
connection - the connection that should be checked in.
info - the JDBC context that was used when the connection was acquired.
See Also:
ConnectionPoolManager.generatePoolKey(String, Properties)

removeConnection

public void removeConnection(java.lang.String poolKey,
                             java.sql.Connection connection)
Description copied from interface: ConnectionPoolManager
Removes a pooled connection from a connection pool. The poolKey is used by the connection pool manager to identify the target connection pool.

Specified by:
removeConnection in interface ConnectionPoolManager
Parameters:
poolKey - a unique identifier for the target connection pool.
connection - the connection that should be checked in.
See Also:
ConnectionPoolManager.generatePoolKey(String, Properties)

generatePoolKey

public java.lang.String generatePoolKey(java.lang.String url,
                                        java.util.Properties info)
Description copied from interface: ConnectionPoolManager
Generates a unique pool identifier (poolKey) for the specified JDBC URL and JDBC driver properties. The connection pool manager may be responsible for managing multiple pool instances for each database instance, user, and password combination.

Specified by:
generatePoolKey in interface ConnectionPoolManager
Parameters:
url - the JDBC url that will be used to create connections in this pool.
info - the JDBC properties that will be used to create connections in this pool.
Returns:
a unique pool identifier as a String.

generatePoolKey

public java.lang.String generatePoolKey(java.lang.String url,
                                        java.lang.String user,
                                        java.lang.String password)
Description copied from interface: ConnectionPoolManager
Generates a unique pool identifier (poolKey) for the specified JDBC URL and JDBC driver properties. The connection pool manager may be responsible for managing multiple pool instances for each database instance, user, and password combination.

Specified by:
generatePoolKey in interface ConnectionPoolManager
Parameters:
url - the JDBC url that will be used to create connections in this pool.
user - the user that will be used for database authentication.
password - the password that will be used for database authentication.
Returns:
a unique pool identifier as a String.

getInitPoolSize

public int getInitPoolSize()
Description copied from interface: ConnectionPoolManager
Returns the initial pool size for connection pools that are managed by this connection pool manager.

The InitPoolSize is typically set as a JVM parameter (for example, java -Djbo.initpoolsize=2 myApplication note that lower case for the JVM parameter is required) or in the jboserver.properties file (for example, jbo.InitPoolSize=2 myApplication).

Specified by:
getInitPoolSize in interface ConnectionPoolManager
Returns:
the initial pool size for this connection pool manager's connection pools.

getMaxPoolSize

public int getMaxPoolSize()
Description copied from interface: ConnectionPoolManager
Returns the maximum pool size for connection pools that are managed by this connection pool manager. A maximum pool size of 0 is used by the database transaction class to indicate that pooling has not been enabled.

The MaxPoolSize is typically set as a JVM parameter (for example, java -Djbo.maxpoolsize=10 myApplication note that lower case for the JVM parameter is required) or in the jboserver.properties file (for example, jbo.MaxPoolSize=10 myApplication).

The maximum number of connections supported by a particular driver should be documented with the driver. The default MaxPoolSize is set high enough so that the driver's maximum number of connections will be reached before the default MaxPoolSize is reached.

Specified by:
getMaxPoolSize in interface ConnectionPoolManager
Returns:
the maximum pool size for this connection pool manager's connection pools.

getMonitorSleepInterval

protected int getMonitorSleepInterval()
Description copied from class: ResourcePoolManager
Returns the interval in milliseconds for which the monitor daemon should sleep between wakeup requests.

Overrides:
getMonitorSleepInterval in class ResourcePoolManager

createPoolMonitor

protected void createPoolMonitor()
Overrides:
createPoolMonitor in class ResourcePoolManager

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.0.0)

E10653-01

Copyright © 1997, 2008, Oracle. All rights reserved.