congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GenericObjectPool.getNumActive
Code IndexAdd Tabnine to your IDE (free)

How to use
getNumActive
method
in
org.apache.commons.pool.impl.GenericObjectPool

Best Java code snippets using org.apache.commons.pool.impl.GenericObjectPool.getNumActive (Showing top 20 results out of 315)

origin: commons-pool/commons-pool

/**
 * 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();
}
origin: commons-pool/commons-pool

/**
 * 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); 
}
origin: commons-pool/commons-pool

/**
 * 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;
}
origin: banq/jdonframework

public int getNumActive() {
  return this.pool.getNumActive();
}
origin: geotools/geotools

/** @see org.geotools.arcsde.session.ISessionPool#getInUseCount() */
public int getInUseCount() {
  checkOpen();
  return pool.getNumActive();
}
origin: geotools/geotools

  @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();
  }
}
origin: geotools/geotools

/** @see org.geotools.arcsde.session.ISessionPool#getAvailableCount() */
public synchronized int getAvailableCount() {
  checkOpen();
  return pool.getMaxActive() - pool.getNumActive();
}
origin: org.mule/mule-core

public int getNumActive()
{
  return pool.getNumActive();
}
origin: org.onehippo.cms7.hst.components/hst-session-pool

/**
 * [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;
  }
}
origin: mysticfall/pivot4j

/**
 * @return the number of active connections
 */
public int getNumActive() {
  return pool.getNumActive();
}
origin: neilbeveridge/zuul-netty

  @Override
  public Integer value() {
    return applicationPool.getNumActive();
  }
});
origin: org.apache.openjpa/openjpa-all

/**
 * [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;
  }
}
origin: org.wamblee/wamblee-test-enterprise

@Override
public int getActiveConnections() {
  return connectionPool.getNumActive();
}
origin: inspectIT/inspectIT

/**
 * Gets {@link #createdCapacity}.
 *
 * @return {@link #createdCapacity}
 */
public long getCreatedCapacity() {
  return (super.getNumActive() + super.getNumIdle()) * bufferSize;
}
origin: org.netpreserve.openwayback/openwayback-core

  public void appendLogInfo(PrintWriter info)
  {
    info.println("  Jedis Active: " + goPool.getNumActive());
    info.println("  Jedis Idle: " + goPool.getNumIdle());
  }
}
origin: com.baidu.beidou/navi-pbrpc

/**
 * 获取活跃的池中对象数量
 * 
 * @return
 */
public int getNumActive() {
  if (this.internalPool == null || this.internalPool.isClosed()) {
    return -1;
  }
  return this.internalPool.getNumActive();
}
origin: neoremind/navi-pbrpc

/**
 * 获取活跃的池中对象数量
 * 
 * @return
 */
public int getNumActive() {
  if (this.internalPool == null || this.internalPool.isClosed()) {
    return -1;
  }
  return this.internalPool.getNumActive();
}
origin: iipc/openwayback

  public void appendLogInfo(PrintWriter info)
  {
    info.println("  Jedis Active: " + goPool.getNumActive());
    info.println("  Jedis Idle: " + goPool.getNumIdle());
  }
}
origin: deegree/deegree3

/**
 * 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();
}
origin: ontopia/ontopia

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);
}
org.apache.commons.pool.implGenericObjectPoolgetNumActive

Javadoc

Return the number of instances currently borrowed from this pool.

Popular methods of GenericObjectPool

  • <init>
    Create a new GenericObjectPool using the specified values.
  • returnObject
    Returns an object instance to the pool. If #getMaxIdle() is set to a positive value and the number
  • borrowObject
    Borrows an object from the pool. If there is an idle instance available in the pool, then either th
  • setMaxActive
    Sets the cap on the number of objects that can be allocated by the pool (checked out to clients, or
  • close
    Closes the pool. Once the pool is closed, #borrowObject()will fail with IllegalStateException, but #
  • setMaxIdle
    Sets the cap on the number of "idle" instances in the pool. If maxIdle is set too low on heavily loa
  • setMinIdle
    Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns
  • setTimeBetweenEvictionRunsMillis
    Sets the number of milliseconds to sleep between runs of the idle object evictor thread. When non-po
  • setMinEvictableIdleTimeMillis
    Sets the minimum amount of time an object may sit idle in the pool before it is eligible for evictio
  • setMaxWait
    Sets the maximum amount of time (in milliseconds) the #borrowObject method should block before throw
  • setTestOnBorrow
    When true, objects will be PoolableObjectFactory#validateObjectbefore being returned by the #borrowO
  • setWhenExhaustedAction
    Sets the action to take when the #borrowObject method is invoked when the pool is exhausted (the max
  • setTestOnBorrow,
  • setWhenExhaustedAction,
  • getNumIdle,
  • setTestWhileIdle,
  • setNumTestsPerEvictionRun,
  • setTestOnReturn,
  • invalidateObject,
  • clear,
  • addObject

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • putExtra (Intent)
  • startActivity (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JTable (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now