Package org.apache.cayenne.datasource
Class ManagedPoolingDataSource
java.lang.Object
org.apache.cayenne.datasource.ManagedPoolingDataSource
- All Implemented Interfaces:
AutoCloseable,Wrapper,CommonDataSource,DataSource,PoolingDataSource,ScopeEventListener
public class ManagedPoolingDataSource extends Object implements PoolingDataSource, ScopeEventListener
A wrapper for
UnmanagedPoolingDataSource that automatically manages
the underlying connection pool size.- Since:
- 4.0
-
Constructor Summary
Constructors Constructor Description ManagedPoolingDataSource(UnmanagedPoolingDataSource dataSource)ManagedPoolingDataSource(UnmanagedPoolingDataSource dataSource, long managerWakeTime) -
Method Summary
Modifier and Type Method Description voidbeforeScopeEnd()Calls#shutdown()to drain the underlying pool, close open connections and block the DataSource from creating any new connections.voidclose()ConnectiongetConnection()ConnectiongetConnection(String username, String password)intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()booleanisWrapperFor(Class<?> iface)voidsetLoginTimeout(int arg0)voidsetLogWriter(PrintWriter arg0)<T> Tunwrap(Class<T> iface)Methods 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
-
ManagedPoolingDataSource
-
ManagedPoolingDataSource
-
-
Method Details
-
beforeScopeEnd
public void beforeScopeEnd()Calls#shutdown()to drain the underlying pool, close open connections and block the DataSource from creating any new connections.- Specified by:
beforeScopeEndin interfaceScopeEventListener
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
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
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-