congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • JTable (javax.swing)
  • CodeWhisperer alternatives
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