本文整理了Java中com.jolbox.bonecp.BoneCP.getConfig()
方法的一些代码示例,展示了BoneCP.getConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoneCP.getConfig()
方法的具体详情如下:
包路径:com.jolbox.bonecp.BoneCP
类名称:BoneCP
方法名:getConfig
[英]Gets config object.
[中]获取配置对象。
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
/** Thread constructor
* @param connectionPartition partition to monitor
* @param pool Pool handle.
*/
public PoolWatchThread(ConnectionPartition connectionPartition, BoneCP pool) {
this.partition = connectionPartition;
this.pool = pool;
this.lazyInit = this.pool.getConfig().isLazyInit();
this.acquireRetryDelayInMs = this.pool.getConfig().getAcquireRetryDelayInMs();
this.poolAvailabilityThreshold = this.pool.getConfig().getPoolAvailabilityThreshold();
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
/** Sends any configured SQL init statement.
* @throws SQLException on error
*/
public void sendInitSQL() throws SQLException {
sendInitSQL(this.connection, this.pool.getConfig().getInitSQL());
}
代码示例来源:origin: io.vertx/vertx-jdbc-client
@Override
public int maximumPoolSize(DataSource dataSource, JsonObject config) {
if (dataSource instanceof BoneCPDataSource) {
BoneCPConfig cfg = ((BoneCPDataSource) dataSource).getPool().getConfig();
return cfg.getMaxConnectionsPerPartition() * cfg.getPartitionCount();
}
return -1;
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
public String toString(){
long timeMillis = System.currentTimeMillis();
return Objects.toStringHelper(this)
.add("url", this.pool.getConfig().getJdbcUrl())
.add("user", this.pool.getConfig().getUsername())
.add("debugHandle", this.debugHandle)
.add("lastResetAgoInSec", TimeUnit.MILLISECONDS.toSeconds(timeMillis-this.connectionLastResetInMs))
.add("lastUsedAgoInSec", TimeUnit.MILLISECONDS.toSeconds(timeMillis-this.connectionLastUsedInMs))
.add("creationTimeAgoInSec", TimeUnit.MILLISECONDS.toSeconds(timeMillis-this.connectionCreationTimeInMs))
.toString();
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
this.connectionHook = pool.getConfig().getConnectionHook();
this.url = pool.getConfig().getJdbcUrl();
this.finalizableRefs = pool.getFinalizableRefs();
this.defaultReadOnly = pool.getConfig().getDefaultReadOnly();
this.defaultCatalog = pool.getConfig().getDefaultCatalog();
this.defaultTransactionIsolationValue = pool.getConfig().getDefaultTransactionIsolationValue();
this.defaultAutoCommit = pool.getConfig().getDefaultAutoCommit();
this.resetConnectionOnClose = pool.getConfig().isResetConnectionOnClose();
this.connectionTrackingDisabled = pool.getConfig().isDisableConnectionTracking();
this.statisticsEnabled = pool.getConfig().isStatisticsEnabled();
this.statistics = pool.getStatistics();
this.detectUnresolvedTransactions = pool.getConfig().isDetectUnresolvedTransactions();
this.detectUnclosedStatements = pool.getConfig().isDetectUnclosedStatements();
this.closeOpenStatements = pool.getConfig().isCloseOpenStatements();
if (this.closeOpenStatements){
trackedStatement = new MapMaker().makeMap();
this.connectionHook = this.pool.getConfig().getConnectionHook();
this.maxConnectionAgeInMs = pool.getConfig().getMaxConnectionAge(TimeUnit.MILLISECONDS);
this.doubleCloseCheck = pool.getConfig().isCloseConnectionWatch();
this.logStatementsEnabled = pool.getConfig().isLogStatementsEnabled();
int cacheSize = pool.getConfig().getStatementsCacheSize();
if ( (cacheSize > 0) && newConnection ) {
this.preparedStatementCache = new StatementCache(cacheSize, pool.getConfig().isStatisticsEnabled(), pool.getStatistics());
this.callableStatementCache = new StatementCache(cacheSize, pool.getConfig().isStatisticsEnabled(), pool.getStatistics());
this.statementCachingEnabled = true;
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
/** Private -- used solely for unit testing.
* @param connection
* @param preparedStatementCache
* @param callableStatementCache
* @param pool
* @return Connection Handle
*/
protected static ConnectionHandle createTestConnectionHandle(Connection connection, IStatementCache preparedStatementCache, IStatementCache callableStatementCache, BoneCP pool){
ConnectionHandle handle = new ConnectionHandle();
handle.connection = connection;
handle.preparedStatementCache = preparedStatementCache;
handle.callableStatementCache = callableStatementCache;
handle.connectionLastUsedInMs = System.currentTimeMillis();
handle.connectionLastResetInMs = System.currentTimeMillis();
handle.connectionCreationTimeInMs = System.currentTimeMillis();
handle.recoveryResult = new TransactionRecoveryResult();
handle.trackedStatement = new MapMaker().makeMap();
handle.url = "foo";
handle.closeOpenStatements = true;
handle.pool = pool;
handle.url=null;
int cacheSize = pool.getConfig().getStatementsCacheSize();
if (cacheSize > 0) {
handle.statementCachingEnabled = true;
}
return handle;
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
Connection result = null;
Connection oldRawConnection = connectionHandle.getInternalConnection();
String url = this.getConfig().getJdbcUrl();
int acquireRetryAttempts = this.getConfig().getAcquireRetryAttempts();
long acquireRetryDelayInMs = this.getConfig().getAcquireRetryDelayInMs();
AcquireFailConfig acquireConfig = new AcquireFailConfig();
acquireConfig.setAcquireRetryAttempts(new AtomicInteger(acquireRetryAttempts));
acquireConfig.setAcquireRetryDelayInMs(acquireRetryDelayInMs);
acquireConfig.setLogMessage("Failed to acquire connection to "+url);
ConnectionHook connectionHook = this.getConfig().getConnectionHook();
do{
result = null;
tryAgain = false;
if (acquireRetryAttempts != this.getConfig().getAcquireRetryAttempts()){
logger.info("Successfully re-established connection to "+url);
ConnectionHandle.sendInitSQL(result, this.getConfig().getInitSQL());
} catch (SQLException e) {
代码示例来源:origin: org.wisdom-framework/wisdom-jdbc-datasources
Connection result;
Connection oldRawConnection = connectionHandle.getInternalConnection();
String url = this.getConfig().getJdbcUrl();
int acquireRetryAttempts = this.getConfig().getAcquireRetryAttempts();
long acquireRetryDelayInMs = this.getConfig().getAcquireRetryDelayInMs();
AcquireFailConfig acquireConfig = new AcquireFailConfig();
acquireConfig.setAcquireRetryAttempts(new AtomicInteger(acquireRetryAttempts));
acquireConfig.setAcquireRetryDelayInMs(acquireRetryDelayInMs);
acquireConfig.setLogMessage("Failed to acquire connection to " + url);
ConnectionHook connectionHook = this.getConfig().getConnectionHook();
do {
result = null;
tryAgain = false;
if (acquireRetryAttempts != this.getConfig().getAcquireRetryAttempts()) {
LOGGER.info("Successfully re-established connection to " + url);
ConnectionHandle.sendInitSQL(result, this.getConfig().getInitSQL());
} catch (SQLException e) {
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
ConnectionHook connectionHook = con.getPool().getConfig().getConnectionHook();
int acquireRetryAttempts = con.getPool().getConfig().getAcquireRetryAttempts();
long acquireRetryDelay = con.getPool().getConfig().getAcquireRetryDelayInMs();
AcquireFailConfig acquireConfig = new AcquireFailConfig();
acquireConfig.setAcquireRetryAttempts(new AtomicInteger(acquireRetryAttempts));
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("url", this.pool.getConfig().getJdbcUrl())
.add("user", this.pool.getConfig().getUsername())
.add("minConnections", this.getMinConnections())
.add("maxConnections", this.getMaxConnections())
.add("acquireIncrement", this.acquireIncrement)
.add("createdConnections", this.createdConnections)
.add("freeConnections", this.getFreeConnections())
.toString();
}
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
/**
* Partition constructor
*
* @param pool handle to connection pool
*/
public ConnectionPartition(BoneCP pool) {
BoneCPConfig config = pool.getConfig();
this.minConnections = config.getMinConnectionsPerPartition();
this.maxConnections = config.getMaxConnectionsPerPartition();
this.acquireIncrement = config.getAcquireIncrement();
this.url = config.getJdbcUrl();
this.username = config.getUsername();
this.password = config.getPassword();
this.poolName = config.getPoolName() != null ? "(in pool '"+config.getPoolName()+"') " : "";
this.pool = pool;
this.disableTracking = config.isDisableConnectionTracking();
this.queryExecuteTimeLimitInNanoSeconds = TimeUnit.NANOSECONDS.convert(config.getQueryExecuteTimeLimitInMs(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
this.connectionHandle = connectionHandle;
this.logStatementsEnabled = logStatementsEnabled;
BoneCPConfig config = connectionHandle.getPool().getConfig();
this.connectionHook = config.getConnectionHook();
this.statistics = connectionHandle.getPool().getStatistics();
内容来源于网络,如有侵权,请联系作者删除!