Package org.apache.tomcat.dbcp.dbcp2
Class PoolingDriver
java.lang.Object
org.apache.tomcat.dbcp.dbcp2.PoolingDriver
- All Implemented Interfaces:
Driver
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final HashMap<String,ObjectPool<? extends Connection>> The map of registered pools.static final StringMy URL prefixprotected static final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs a new driver withaccessToUnderlyingConnectionAllowedenabled.protectedPoolingDriver(boolean accessToUnderlyingConnectionAllowed) For unit testing purposes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsURL(String url) voidCloses a named pool.connect(String url, Properties info) ObjectPool<? extends Connection>getConnectionPool(String name) Gets the connection pool for the given name.intintString[]Gets the pool names.getPropertyInfo(String url, Properties info) voidInvalidates the given connection.protected booleanReturns the value of the accessToUnderlyingConnectionAllowed property.booleanvoidregisterPool(String name, ObjectPool<? extends Connection> pool) Registers a named pool.
-
Field Details
-
pools
The map of registered pools. -
URL_PREFIX
My URL prefix- See Also:
-
URL_PREFIX_LEN
protected static final int URL_PREFIX_LEN -
MAJOR_VERSION
protected static final int MAJOR_VERSION- See Also:
-
MINOR_VERSION
protected static final int MINOR_VERSION- See Also:
-
-
Constructor Details
-
PoolingDriver
public PoolingDriver()Constructs a new driver withaccessToUnderlyingConnectionAllowedenabled. -
PoolingDriver
protected PoolingDriver(boolean accessToUnderlyingConnectionAllowed) For unit testing purposes.- Parameters:
accessToUnderlyingConnectionAllowed- DoDelegatingConnections created by this driver permit access to the delegate?
-
-
Method Details
-
isAccessToUnderlyingConnectionAllowed
protected boolean isAccessToUnderlyingConnectionAllowed()Returns the value of the accessToUnderlyingConnectionAllowed property.- Returns:
- true if access to the underlying is allowed, false otherwise.
-
getConnectionPool
Gets the connection pool for the given name.- Parameters:
name- The pool name- Returns:
- The pool
- Throws:
SQLException- Thrown when the named pool is not registered.
-
registerPool
Registers a named pool.- Parameters:
name- The pool name.pool- The pool.
-
closePool
Closes a named pool.- Parameters:
name- The pool name.- Throws:
SQLException- Thrown when a problem is caught closing the pool.
-
getPoolNames
Gets the pool names.- Returns:
- the pool names.
-
acceptsURL
- Specified by:
acceptsURLin interfaceDriver- Throws:
SQLException
-
connect
- Specified by:
connectin interfaceDriver- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver- Throws:
SQLFeatureNotSupportedException
-
invalidateConnection
Invalidates the given connection.- Parameters:
conn- connection to invalidate- Throws:
SQLException- if the connection is not aPoolGuardConnectionWrapperor an error occurs invalidating the connection
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfaceDriver
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliantin interfaceDriver
-
getPropertyInfo
- Specified by:
getPropertyInfoin interfaceDriver
-