/** * 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(); }
/** * Sets the {@link PoolableObjectFactory factory} this pool uses * to create new instances. Trying to change * the <code>factory</code> while there are borrowed objects will * throw an {@link IllegalStateException}. If there are instances idle * in the pool when this method is invoked, these will be destroyed * using the original factory. * * @param factory the {@link PoolableObjectFactory} used to create new instances. * @throws IllegalStateException when the factory cannot be set at this time * @deprecated to be removed in version 2.0 */ @Deprecated @Override public void setFactory(PoolableObjectFactory<T> factory) throws IllegalStateException { List<ObjectTimestampPair<T>> toDestroy = new ArrayList<ObjectTimestampPair<T>>(); final PoolableObjectFactory<T> oldFactory = _factory; synchronized (this) { assertOpen(); if(0 < getNumActive()) { throw new IllegalStateException("Objects are already active"); } else { toDestroy.addAll(_pool); _numInternalProcessing = _numInternalProcessing + _pool._size; _pool.clear(); } _factory = factory; } destroy(toDestroy, oldFactory); }
/** * 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 getNumActive() { return this.pool.getNumActive(); }
/** @see org.geotools.arcsde.session.ISessionPool#getInUseCount() */ public int getInUseCount() { checkOpen(); return pool.getNumActive(); }
@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(); } }
/** @see org.geotools.arcsde.session.ISessionPool#getAvailableCount() */ public synchronized int getAvailableCount() { checkOpen(); return pool.getMaxActive() - pool.getNumActive(); }
public int getNumActive() { return pool.getNumActive(); }
/** * [Read Only] The current number of active connections that have been * allocated from this data source. * * @return the current number of active connections */ public int getNumActive() { if (sessionPool != null) { return sessionPool.getNumActive(); } else { return 0; } }
/** * @return the number of active connections */ public int getNumActive() { return pool.getNumActive(); }
@Override public Integer value() { return applicationPool.getNumActive(); } });
/** * [Read Only] The current number of active connections that have been * allocated from this data source. * * @return the current number of active connections */ public synchronized int getNumActive() { if (connectionPool != null) { return connectionPool.getNumActive(); } else { return 0; } }
@Override public int getActiveConnections() { return connectionPool.getNumActive(); }
/** * 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()); } }
/** * 获取活跃的池中对象数量 * * @return */ public int getNumActive() { if (this.internalPool == null || this.internalPool.isClosed()) { return -1; } return this.internalPool.getNumActive(); }
/** * 获取活跃的池中对象数量 * * @return */ public int getNumActive() { if (this.internalPool == null || this.internalPool.isClosed()) { return -1; } return this.internalPool.getNumActive(); }
public void appendLogInfo(PrintWriter info) { info.println(" Jedis Active: " + goPool.getNumActive()); info.println(" Jedis Idle: " + goPool.getNumIdle()); } }
/** * 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(); }
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); }