Business Components

oracle.jbo.server
Interface ConnectionPoolManager


public interface ConnectionPoolManager

Declares ConnectionPoolManager operations. If JDBC connection pooling has been enabled, the ConnectionPoolManager is invoked by the BC4J database transaction class to manage cached JDBC connection instances. The following guidelines should be followed when implementing a custom ConnectionPoolManager:

The connection pool manager should be able to support multiple database instance, user, and password combinations. For more information see {link #generatePoolKey generatePoolKey}.

See Also:

Method Summary
 void addConnection(java.lang.String poolKey, java.sql.Connection connection)
          Add a connection to a connection pool.
 java.lang.String generatePoolKey(java.lang.String url, java.util.Properties info)
          Generate a unique pool identifier 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)
          Generate a unique pool identifier for the specified JDBC URL and JDBC driver properties.
 java.sql.Connection getConnection(java.lang.String connectionPoolKey, java.lang.String url, java.util.Properties info, java.lang.String user, java.lang.String password)
          Get a pooled connection from the specified target pool.
 int getInitPoolSize()
          Return the initial pool size for connection pools that are managed by this connection pool manager.
 int getMaxPoolSize()
          Return the maximum pool size for connection pools that are managed by this connection pool manager.
 void removeConnection(java.lang.String poolKey, java.sql.Connection connection)
          Remove a pooled connection from a connection pool.
 void returnConnection(java.lang.String poolKey, java.sql.Connection connection)
          Return a pooled connection to a connection pool.
 

Method Detail

getConnection

public java.sql.Connection getConnection(java.lang.String connectionPoolKey,
                                         java.lang.String url,
                                         java.util.Properties info,
                                         java.lang.String user,
                                         java.lang.String password)
Get a pooled connection from the specified target pool.
See Also:

returnConnection

public void returnConnection(java.lang.String poolKey,
                             java.sql.Connection connection)
Return 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 that does in fact belong to the specified connection pool.

Parameters:
poolKey - A unique identifier for the target connection pool.
connection - The connection that should be checked in.
See Also:

addConnection

public void addConnection(java.lang.String poolKey,
                          java.sql.Connection connection)
Add 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.

Parameters:
poolKey - A unique identifier for the target connection pool.
connection - The connection that should be checked in.
See Also:
,

removeConnection

public void removeConnection(java.lang.String poolKey,
                             java.sql.Connection connection)
Remove a pooled connection from a connection pool. The poolKey is used by the connection pool manager to identify the target connection pool.
Parameters:
poolKey - A unique identifier for the target connection pool.
connection - The connection that should be checked in.
See Also:

generatePoolKey

public java.lang.String generatePoolKey(java.lang.String url,
                                        java.util.Properties info)
Generate a unique pool identifier 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.
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.

generatePoolKey

public java.lang.String generatePoolKey(java.lang.String url,
                                        java.lang.String user,
                                        java.lang.String password)
Generate a unique pool identifier 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.
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

getMaxPoolSize

public int getMaxPoolSize()
Return 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.

getInitPoolSize

public int getInitPoolSize()
Return the initial pool size for connection pools that are managed by this connection pool manager.

Business Components