public class AnterosDBCPDataSource extends AnterosDBCPConfig implements DataSource, Closeable
| Constructor and Description |
|---|
AnterosDBCPDataSource()
Default constructor.
|
AnterosDBCPDataSource(AnterosDBCPConfig configuration)
Construct a AnterosDBCPDataSource with the specified configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shutdown the DataSource and its associated pool.
|
void |
evictConnection(Connection connection)
Evict a connection from the pool.
|
AnterosDBCPConfigMXBean |
getAnterosDBCPConfigMXBean()
Get the
AnterosDBCPConfigMXBean for this AnterosDBCPDataSource instance. |
AnterosDBCPPoolMXBean |
getAnterosDBCPPoolMXBean()
Get the
AnterosDBCPPoolMXBean for this AnterosDBCPDataSource instance. |
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
boolean |
isClosed()
Determine whether the AnterosDBCPDataSource has been closed.
|
boolean |
isRunning()
Returns
true if the pool as been started and is not suspended or shutdown. |
boolean |
isWrapperFor(Class<?> iface) |
void |
setHealthCheckRegistry(Object healthCheckRegistry)
Set the HealthCheckRegistry that will be used for registration of health checks by AnterosDBCPCP.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setMetricRegistry(Object metricRegistry)
Set a MetricRegistry instance to use for registration of metrics used by AnterosDBCPCP.
|
void |
setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory) |
String |
toString() |
<T> T |
unwrap(Class<T> iface) |
addDataSourceProperty, addHealthCheckProperty, copyStateTo, getCatalog, getConnectionInitSql, getConnectionTestQuery, getConnectionTimeout, getDataSource, getDataSourceClassName, getDataSourceJNDI, getDataSourceProperties, getDriverClassName, getHealthCheckProperties, getHealthCheckRegistry, getIdleTimeout, getInitializationFailTimeout, getJdbcUrl, getLeakDetectionThreshold, getMaximumPoolSize, getMaxLifetime, getMetricRegistry, getMetricsTrackerFactory, getMinimumIdle, getPassword, getPoolName, getScheduledExecutor, getSchema, getThreadFactory, getTransactionIsolation, getUsername, getValidationTimeout, isAllowPoolSuspension, isAutoCommit, isIsolateInternalQueries, isReadOnly, isRegisterMbeans, setAllowPoolSuspension, setAutoCommit, setCatalog, setConnectionInitSql, setConnectionTestQuery, setConnectionTimeout, setDataSource, setDataSourceClassName, setDataSourceJNDI, setDataSourceProperties, setDriverClassName, setHealthCheckProperties, setIdleTimeout, setInitializationFailTimeout, setIsolateInternalQueries, setJdbcUrl, setLeakDetectionThreshold, setMaximumPoolSize, setMaxLifetime, setMinimumIdle, setPassword, setPoolName, setReadOnly, setRegisterMbeans, setScheduledExecutor, setSchema, setThreadFactory, setTransactionIsolation, setUsername, setValidationTimeout, validatepublic AnterosDBCPDataSource()
AnterosDBCPDataSource(AnterosDBCPConfig) will
result in getConnection() performance that is slightly lower
due to lazy initialization checks.
The first call to getConnection() starts the pool. Once the pool
is started, the configuration is "sealed" and no further configuration
changes are possible -- except via AnterosDBCPConfigMXBean methods.public AnterosDBCPDataSource(AnterosDBCPConfig configuration)
AnterosDBCPConfig is copied and the pool is started by invoking this
constructor.
The AnterosDBCPConfig can be modified without affecting the AnterosDBCPDataSource
and used to initialize another AnterosDBCPDataSource instance.configuration - a AnterosDBCPConfig instancepublic Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getConnection(String username, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourceSQLExceptionpublic void setLogWriter(PrintWriter out) throws SQLException
setLogWriter in interface CommonDataSourceSQLExceptionpublic void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLExceptionpublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic void setMetricRegistry(Object metricRegistry)
setMetricRegistry in class AnterosDBCPConfigmetricRegistry - the MetricRegistry instance to usepublic void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
setMetricsTrackerFactory in class AnterosDBCPConfigpublic void setHealthCheckRegistry(Object healthCheckRegistry)
null.setHealthCheckRegistry in class AnterosDBCPConfighealthCheckRegistry - the HealthCheckRegistry to be usedpublic boolean isRunning()
true if the pool as been started and is not suspended or shutdown.true if the pool as been started and is not suspended or shutdown.public AnterosDBCPPoolMXBean getAnterosDBCPPoolMXBean()
AnterosDBCPPoolMXBean for this AnterosDBCPDataSource instance. If this method is called on
a AnterosDBCPDataSource that has been constructed without a AnterosDBCPConfig instance,
and before an initial call to #getConnection(), the return value will be null.AnterosDBCPPoolMXBean instance, or null.public AnterosDBCPConfigMXBean getAnterosDBCPConfigMXBean()
AnterosDBCPConfigMXBean for this AnterosDBCPDataSource instance.AnterosDBCPConfigMXBean instance.public void evictConnection(Connection connection)
connection - the connection to evict from the poolpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
Copyright © 2019 Anteros Tecnologia. All rights reserved.