Package org.opennms.core.db
Interface ClosableDataSource
-
- All Superinterfaces:
AutoCloseable,Closeable,CommonDataSource,DataSource,Wrapper
- All Known Implementing Classes:
AtomikosDataSourceFactory,BaseConnectionFactory,C3P0ConnectionFactory,HikariCPConnectionFactory
public interface ClosableDataSource extends DataSource, Closeable
ClosableDataSource interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close the datasource, if necessary.voidsetIdleTimeout(int idleTimeout)How long, in seconds, an idle connection is kept in the pool before it is removed.voidsetLoginTimeout(int loginTimeout)How long, in seconds, to attempt to make a connection to the database.voidsetMaxPool(int maxPool)The maximum number of pooled connections to retain.voidsetMaxSize(int maxSize)The maximum number of connections that can be created.voidsetMinPool(int minPool)The minimum number of pooled connections to retain.-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder, getParentLogger
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder, getConnection, getConnection, getLoginTimeout, getLogWriter, setLogWriter
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Method Detail
-
close
void close()
Close the datasource, if necessary.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
setIdleTimeout
void setIdleTimeout(int idleTimeout)
How long, in seconds, an idle connection is kept in the pool before it is removed.- Parameters:
idleTimeout-
-
setLoginTimeout
void setLoginTimeout(int loginTimeout) throws SQLExceptionHow long, in seconds, to attempt to make a connection to the database.- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
setMinPool
void setMinPool(int minPool)
The minimum number of pooled connections to retain.- Parameters:
minPool-
-
setMaxPool
void setMaxPool(int maxPool)
The maximum number of pooled connections to retain.- Parameters:
maxPool-
-
setMaxSize
void setMaxSize(int maxSize)
The maximum number of connections that can be created.- Parameters:
maxSize-
-
-