congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
StackObjectPool
Code IndexAdd Tabnine to your IDE (free)

How to use
StackObjectPool
in
org.apache.commons.pool.impl

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

origin: commons-pool/commons-pool

/**
 * Create a StackObjectPool.
 * 
 * @return a new StackObjectPool with the configured factory, maxIdle and initial capacity settings
 */
public ObjectPool<T> createPool() {
  return new StackObjectPool<T>(_factory,_maxSleeping,_initCapacity);
}
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}.
 *
 * @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 pool 2.0
 */
@Deprecated
@Override
public synchronized void setFactory(PoolableObjectFactory<T> factory) throws IllegalStateException {
  assertOpen();
  if(0 < getNumActive()) {
    throw new IllegalStateException("Objects are already active");
  } else {
    clear();
    _factory = factory;
  }
}
origin: commons-pool/commons-pool

boolean success = !isClosed();
if(null != _factory) {
  if(!_factory.validateObject(obj)) {
origin: commons-pool/commons-pool

assertOpen();
if (_factory == null) {
  throw new IllegalStateException("Cannot add objects without a factory.");
origin: commons-pool/commons-pool

/**
 * <p>Close this pool, and free any resources associated with it. Invokes
 * {@link #clear()} to destroy and remove instances in the pool.</p>
 * 
 * <p>Calling {@link #addObject} or {@link #borrowObject} after invoking
 * this method on a pool will cause them to throw an
 * {@link IllegalStateException}.</p>
 *
 * @throws Exception never - exceptions clearing the pool are swallowed
 */
@Override
public void close() throws Exception {
  super.close();
  clear();
}
origin: commons-pool/commons-pool

assertOpen();
T obj = null;
boolean newlyCreated = false;
origin: org.apache.openjpa/openjpa-all

/**
 * <p>Close this pool, and free any resources associated with it. Invokes
 * {@link #clear()} to destroy and remove instances in the pool.</p>
 * 
 * <p>Calling {@link #addObject} or {@link #borrowObject} after invoking
 * this method on a pool will cause them to throw an
 * {@link IllegalStateException}.</p>
 *
 * @throws Exception never - exceptions clearing the pool are swallowed
 */
@Override
public void close() throws Exception {
  super.close();
  clear();
}
origin: org.apache.openjpa/openjpa-all

/**
 * Create a StackObjectPool.
 * 
 * @return a new StackObjectPool with the configured factory, maxIdle and initial capacity settings
 */
public ObjectPool<T> createPool() {
  return new StackObjectPool<T>(_factory,_maxSleeping,_initCapacity);
}
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 synchronized void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
  assertOpen();
  if(0 < getNumActive()) {
    throw new IllegalStateException("Objects are already active");
  } else {
    clear();
    _factory = factory;
  }
}
origin: org.apache.commons/com.springsource.org.apache.commons.pool

assertOpen();
if (_factory == null) {
  throw new IllegalStateException("Cannot add objects without a factory.");
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

/**
 * Close this pool, and free any resources associated with it.
 * <p>
 * Calling {@link #addObject} or {@link #borrowObject} after invoking
 * this method on a pool will cause them to throw an
 * {@link IllegalStateException}.
 * </p>
 *
 * @throws Exception <strong>deprecated</strong>: implementations should silently fail if not all resources can be freed.
 */
public void close() throws Exception {
  super.close();
  clear();
}
origin: org.apache.commons/com.springsource.org.apache.commons.pool

public synchronized void returnObject(Object obj) throws Exception {
  boolean success = !isClosed();
  if(null != _factory) {
    if(!_factory.validateObject(obj)) {
origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

public void init() {
  clientPool = new StackObjectPool(new BasePoolableObjectFactory() {
    @Override
    public Object makeObject() throws Exception {
      return new RemoteAuthorizationManagerClient();
    }
  });
}
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 synchronized void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
  assertOpen();
  if(0 < getNumActive()) {
    throw new IllegalStateException("Objects are already active");
  } else {
    clear();
    _factory = factory;
  }
}
origin: org.apache.commons/com.springsource.org.apache.commons.pool

public synchronized Object borrowObject() throws Exception {
  assertOpen();
  Object obj = null;
  boolean newlyCreated = false;
origin: org.apache.commons/com.springsource.org.apache.commons.pool

/**
 * Close this pool, and free any resources associated with it.
 * <p>
 * Calling {@link #addObject} or {@link #borrowObject} after invoking
 * this method on a pool will cause them to throw an
 * {@link IllegalStateException}.
 * </p>
 *
 * @throws Exception <strong>deprecated</strong>: implementations should silently fail if not all resources can be freed.
 */
public void close() throws Exception {
  super.close();
  clear();
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

public synchronized void returnObject(Object obj) throws Exception {
  boolean success = !isClosed();
  if(null != _factory) {
    if(!_factory.validateObject(obj)) {
origin: org.apache.commons/pool

/**
 * Create a StackObjectPool.
 * 
 * @return a new StackObjectPool with the configured factory, maxIdle and initial capacity settings
 */
public ObjectPool<T> createPool() {
  return new StackObjectPool<T>(_factory,_maxSleeping,_initCapacity);
}
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}.
 *
 * @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 pool 2.0
 */
@Deprecated
@Override
public synchronized void setFactory(PoolableObjectFactory<T> factory) throws IllegalStateException {
  assertOpen();
  if(0 < getNumActive()) {
    throw new IllegalStateException("Objects are already active");
  } else {
    clear();
    _factory = factory;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

public synchronized Object borrowObject() throws Exception {
  assertOpen();
  Object obj = null;
  boolean newlyCreated = false;
org.apache.commons.pool.implStackObjectPool

Javadoc

A simple, java.util.Stack-based ObjectPool implementation.

Given a PoolableObjectFactory, this class will maintain a simple pool of instances. A finite number of "sleeping" or idle instances is enforced, but when the pool is empty, new instances are created to support the new load. Hence this class places no limit on the number of "active" instances created by the pool, but is quite useful for re-using Objects without introducing artificial limits.

Most used methods

  • <init>
    Create a new SimpleObjectPool using the specified factory to create new instances, capping the numbe
  • assertOpen
  • clear
    Clears any objects sitting idle in the pool.
  • getNumActive
    Return the number of instances currently borrowed from this pool.
  • isClosed

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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