/** * Returns pool info including {@link #getNumActive()}, {@link #getNumIdle()} * and a list of objects idle in the pool with their idle times. * * @return string containing debug information */ synchronized String debugInfo() { StringBuffer buf = new StringBuffer(); buf.append("Active: ").append(getNumActive()).append("\n"); buf.append("Idle: ").append(getNumIdle()).append("\n"); buf.append("Idle Objects:\n"); Iterator<ObjectTimestampPair<T>> it = _pool.iterator(); long time = System.currentTimeMillis(); while(it.hasNext()) { ObjectTimestampPair<T> pair = it.next(); buf.append("\t").append(pair.value).append("\t").append(time - pair.tstamp).append("\n"); } return buf.toString(); }
/** * This returns the number of objects to create during the pool * sustain cycle. This will ensure that the minimum number of idle * instances is maintained without going past the maxActive value. * * @param incrementInternal - Should the count of objects currently under * some form of internal processing be * incremented? * @return The number of objects to be created */ private synchronized int calculateDeficit(boolean incrementInternal) { int objectDeficit = getMinIdle() - getNumIdle(); if (_maxActive > 0) { int growLimit = Math.max(0, getMaxActive() - getNumActive() - getNumIdle() - _numInternalProcessing); objectDeficit = Math.min(objectDeficit, growLimit); } if (incrementInternal && objectDeficit >0) { _numInternalProcessing++; } return objectDeficit; }
public int getNumIdle() { return this.pool.getNumIdle(); }
@Override public String toString() { StringBuilder ret = new StringBuilder(getClass().getSimpleName()); ret.append("[config=").append(getConfig()); if (pool == null) { ret.append("[Session pool is disposed]"); } else { ret.append("[ACTIVE: "); ret.append(pool.getNumActive() + "/" + ((GenericObjectPool) pool).getMaxActive()); ret.append(" INACTIVE: "); ret.append(pool.getNumIdle() + "/" + ((GenericObjectPool) pool).getMaxIdle() + "]"); } ret.append("]"); return ret.toString(); } }
} else if ((getSoftMinEvictableIdleTimeMillis() > 0) && (idleTimeMilis > getSoftMinEvictableIdleTimeMillis()) && ((getNumIdle() + 1)> getMinIdle())) { // +1 accounts for object we are processing removeObject = true;
/** * @return Returns the pool size. */ public int getBufferPoolSize() { return super.getNumIdle(); }
@Override public Integer value() { return applicationPool.getNumIdle(); } });
/** * Gets {@link #availableCapacity}. * * @return {@link #availableCapacity} */ public long getAvailableCapacity() { return super.getNumIdle() * bufferSize; }
/** * @return the number of idle connections */ public int getNumIdle() { return pool.getNumIdle(); }
/** * [Read Only] The current number of idle connections that are waiting * to be allocated from this data source. * * @return the current number of idle connections */ public synchronized int getNumIdle() { if (connectionPool != null) { return connectionPool.getNumIdle(); } else { return 0; } }
/** * [Read Only] The current number of idle connections that are waiting * to be allocated from this data source. * * @return the current number of idle connections */ public synchronized int getNumIdle() { if (connectionPool != null) { return connectionPool.getNumIdle(); } else { return 0; } }
public int getQueryConnectionInactiveSize() { return queryPool.getNumIdle(); }
public int getWriteConnectionInactiveSize() { return rwPool.getNumIdle(); }
/** * Gets {@link #createdCapacity}. * * @return {@link #createdCapacity} */ public long getCreatedCapacity() { return (super.getNumActive() + super.getNumIdle()) * bufferSize; }
public void appendLogInfo(PrintWriter info) { info.println(" Jedis Active: " + goPool.getNumActive()); info.println(" Jedis Idle: " + goPool.getNumIdle()); } }
public void appendLogInfo(PrintWriter info) { info.println(" Jedis Active: " + goPool.getNumActive()); info.println(" Jedis Idle: " + goPool.getNumIdle()); } }
/** * 获取暂时idle的对象数量 * * @return */ public int getNumIdle() { if (this.internalPool == null || this.internalPool.isClosed()) { return -1; } return internalPool.getNumIdle(); }
/** * 获取暂时idle的对象数量 * * @return */ public int getNumIdle() { if (this.internalPool == null || this.internalPool.isClosed()) { return -1; } return internalPool.getNumIdle(); }
public void writeReport(java.io.Writer out) throws java.io.IOException { final String BR = "<br>\n"; out.write("Active connections: " + pool.getNumActive() + " (max: " + pool.getMaxActive() + ")<br>\n"); out.write("Idle connections: " + pool.getNumIdle() + " (min: " + pool.getMinIdle() + " max: " + pool.getMaxIdle() + ")<br>\n"); out.write("Connections created: " + pcfactory.objectsCreated + BR); out.write("Connections destroyed: " + pcfactory.objectsDestroyed + BR); out.write("Connections validated: " + pcfactory.objectsValidated + BR); out.write("Connections activated: " + pcfactory.objectsActivated + BR); out.write("Connections passivated: " + pcfactory.objectsPassivated + BR); }
/** * Returns a {@link Connection} from the pool. * * @return a connection from the pool * @throws SQLException */ public Connection getConnection() throws SQLException { LOG.debug( "For connection id '{}': active connections: {}, idle connections: {}", new Object[] { id, pool.getNumActive(), pool.getNumIdle() } ); return ds.getConnection(); }