Codota Logo
GenericObjectPool.assertOpen
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain GenericObjectPool
private void myMethod () {
GenericObjectPool g =
  • Codota Iconnew GenericObjectPool()
  • Codota Iconnew GenericObjectPool(null)
  • Codota IconPoolableObjectFactory factory;new GenericObjectPool(factory)
  • Smart code suggestions by Codota
}
origin: commons-pool/commons-pool

/**
 * Create an object, and place it into the pool.
 * addObject() is useful for "pre-loading" a pool with idle objects.
 */
@Override
public void addObject() throws Exception {
  assertOpen();
  if (_factory == null) {
    throw new IllegalStateException("Cannot add objects without a factory.");
  }
  T obj = _factory.makeObject();
  try {
    assertOpen();
    addObjectToPool(obj, false);
  } catch (IllegalStateException ex) { // Pool closed
    try {
      _factory.destroyObject(obj);
    } catch (Exception ex2) {
      // swallow
    }
    throw ex;
  }
}
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

assertOpen();
origin: commons-pool/commons-pool

assertOpen();
synchronized (this) {
  if(_pool.isEmpty()) {
origin: org.apache.commons/com.springsource.org.apache.commons.pool

/**
 * Create an object, and place it into the pool.
 * addObject() is useful for "pre-loading" a pool with idle objects.
 */
public void addObject() throws Exception {
  assertOpen();
  if (_factory == null) {
    throw new IllegalStateException("Cannot add objects without a factory.");
  }
  Object obj = _factory.makeObject();
  try {
    assertOpen();
    addObjectToPool(obj, false);
  } catch (IllegalStateException ex) { // Pool closed
    try {
      _factory.destroyObject(obj);
    } catch (Exception ex2) {
      // swallow
    }
    throw ex;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

/**
 * Create an object, and place it into the pool.
 * addObject() is useful for "pre-loading" a pool with idle objects.
 */
public void addObject() throws Exception {
  assertOpen();
  if (_factory == null) {
    throw new IllegalStateException("Cannot add objects without a factory.");
  }
  Object obj = _factory.makeObject();
  try {
    assertOpen();
    addObjectToPool(obj, false);
  } catch (IllegalStateException ex) { // Pool closed
    try {
      _factory.destroyObject(obj);
    } catch (Exception ex2) {
      // swallow
    }
    throw ex;
  }
}
origin: org.apache.openjpa/openjpa-all

/**
 * Create an object, and place it into the pool.
 * addObject() is useful for "pre-loading" a pool with idle objects.
 */
@Override
public void addObject() throws Exception {
  assertOpen();
  if (_factory == null) {
    throw new IllegalStateException("Cannot add objects without a factory.");
  }
  T obj = _factory.makeObject();
  try {
    assertOpen();
    addObjectToPool(obj, false);
  } catch (IllegalStateException ex) { // Pool closed
    try {
      _factory.destroyObject(obj);
    } catch (Exception ex2) {
      // swallow
    }
    throw ex;
  }
}
origin: org.apache.commons/pool

/**
 * Create an object, and place it into the pool.
 * addObject() is useful for "pre-loading" a pool with idle objects.
 */
@Override
public void addObject() throws Exception {
  assertOpen();
  if (_factory == null) {
    throw new IllegalStateException("Cannot add objects without a factory.");
  }
  T obj = _factory.makeObject();
  try {
    assertOpen();
    addObjectToPool(obj, false);
  } catch (IllegalStateException ex) { // Pool closed
    try {
      _factory.destroyObject(obj);
    } catch (Exception ex2) {
      // swallow
    }
    throw ex;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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}.
 *
 * @param factory the {@link PoolableObjectFactory} used to create new instances.
 * @throws IllegalStateException when the factory cannot be set at this time
 */
public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
  List toDestroy = new ArrayList();
  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);
}
origin: org.apache.commons/com.springsource.org.apache.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}.
 *
 * @param factory the {@link PoolableObjectFactory} used to create new instances.
 * @throws IllegalStateException when the factory cannot be set at this time
 */
public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
  List toDestroy = new ArrayList();
  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);
}
origin: org.apache.openjpa/openjpa-all

/**
 * 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: org.apache.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: org.apache.commons/com.springsource.org.apache.commons.pool

assertOpen();
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

assertOpen();
origin: org.apache.commons/pool

assertOpen();
origin: org.apache.openjpa/openjpa-all

assertOpen();
origin: org.apache.openjpa/openjpa-all

assertOpen();
synchronized (this) {
  if(_pool.isEmpty()) {
origin: org.apache.commons/com.springsource.org.apache.commons.pool

assertOpen();
synchronized (this) {
  if(_pool.isEmpty()) {
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

assertOpen();
synchronized (this) {
  if(_pool.isEmpty()) {
origin: org.apache.commons/pool

assertOpen();
synchronized (this) {
  if(_pool.isEmpty()) {
org.apache.commons.pool.implGenericObjectPoolassertOpen

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,
  • getNumActive,
  • getNumIdle,
  • setTestWhileIdle,
  • setNumTestsPerEvictionRun,
  • setTestOnReturn,
  • invalidateObject,
  • clear,
  • addObject

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • BoxLayout (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now