Package org.attribyte.sql.pool
Class ConnectionPoolDataSource
java.lang.Object
org.attribyte.sql.pool.ConnectionPoolDataSource
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
A
DataSource implementation for pools.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a datasource from a pool.ConnectionPoolDataSource(ConnectionPool.Initializer initializer) Creates a data source from a pool initializer. -
Method Summary
Modifier and TypeMethodDescriptiongetConnection(String username, String password) intbooleanisWrapperFor(Class<?> iface) voidsetLoginTimeout(int sourceTimeoutSeconds) voidsetLogWriter(PrintWriter out) voidshutdown()Shutdown the underlying pool.<T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilderMethods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Constructor Details
-
ConnectionPoolDataSource
public ConnectionPoolDataSource(ConnectionPool.Initializer initializer) throws org.attribyte.api.InitializationException, SQLException Creates a data source from a pool initializer.- Parameters:
initializer- The initializer.- Throws:
org.attribyte.api.InitializationException- if the pool could not be created.SQLException- if pool connections could not be created.
-
ConnectionPoolDataSource
Creates a datasource from a pool.- Parameters:
pool- The pool.
-
-
Method Details
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
shutdown
public void shutdown()Shutdown the underlying pool.
-