@Override public Double getValue() { if (ds.getPool() != null) { return ds.getPool().getStatistics().getConnectionWaitTimeAvg(); } else { return 0.0; } } });
@Override public Integer getValue() { if (ds.getPool() != null) { return ds.getPool().getStatistics().getTotalCreatedConnections(); } else { return 0; } } });
@Override public Integer getValue() { if (ds.getPool() != null) { return ds.getPool().getStatistics().getTotalFree(); } else { return 0; } } });
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
/** * {@inheritDoc} * * @see com.jolbox.bonecp.IStatementCache#get(java.lang.String) */ // @Override public StatementHandle get(String key){ StatementHandle statement = this.cache.get(key); if (statement != null && !statement.logicallyClosed.compareAndSet(true, false)){ statement = null; } if (this.maintainStats){ if (statement != null){ this.statistics.incrementCacheHits(); } else { this.statistics.incrementCacheMiss(); } } return statement; }
/** Call the onQueryExecuteTimeLimitExceeded hook if necessary * @param sql sql statement that took too long * @param queryStartTime time when query was started. */ protected void queryTimerEnd(String sql, long queryStartTime) { if ((this.queryExecuteTimeLimit != 0) && (this.connectionHook != null)){ long timeElapsed = (System.nanoTime() - queryStartTime); if (timeElapsed > this.queryExecuteTimeLimit){ this.connectionHook.onQueryExecuteTimeLimitExceeded(this.connectionHandle, this, sql, this.logParams, timeElapsed); } } if (this.statisticsEnabled){ this.statistics.incrementStatementsExecuted(); this.statistics.addStatementExecuteTime(System.nanoTime() - queryStartTime); } }
@Override public Integer getValue() { if (ds.getPool() != null) { return ds.getPool().getStatistics().getTotalLeased(); } else { return 0; } } });
/** Prep for a new connection * @return if stats are enabled, return the nanoTime when this connection was requested. * @throws SQLException */ protected long preConnection() throws SQLException{ long statsObtainTime = 0; if (this.pool.poolShuttingDown){ throw new SQLException(this.pool.shutdownStackTrace); } if (this.pool.statisticsEnabled){ statsObtainTime = System.nanoTime(); this.pool.statistics.incrementConnectionsRequested(); } return statsObtainTime; }
/** After obtaining a connection, perform additional tasks. * @param handle * @param statsObtainTime */ protected void postConnection(ConnectionHandle handle, long statsObtainTime){ handle.renewConnection(); // mark it as being logically "open" // Give an application a chance to do something with it. if (handle.getConnectionHook() != null){ handle.getConnectionHook().onCheckOut(handle); } if (this.pool.closeConnectionWatch){ // a debugging tool this.pool.watchConnection(handle); } if (this.pool.statisticsEnabled){ this.pool.statistics.addCumulativeConnectionWaitTime(System.nanoTime()-statsObtainTime); } }
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();
this.statistics.addStatementPrepareTime(System.nanoTime()-statStart); this.statistics.incrementStatementsPrepared();