/** * 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); }
/** * 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; } }
boolean success = !isClosed(); if(null != _factory) { if(!_factory.validateObject(obj)) {
assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory.");
/** * <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(); }
assertOpen(); T obj = null; boolean newlyCreated = false;
/** * <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(); }
/** * 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); }
/** * 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; } }
assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory.");
/** * 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(); }
public synchronized void returnObject(Object obj) throws Exception { boolean success = !isClosed(); if(null != _factory) { if(!_factory.validateObject(obj)) {
public void init() { clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { return new RemoteAuthorizationManagerClient(); } }); }
/** * 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; } }
public synchronized Object borrowObject() throws Exception { assertOpen(); Object obj = null; boolean newlyCreated = false;
/** * 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(); }
public synchronized void returnObject(Object obj) throws Exception { boolean success = !isClosed(); if(null != _factory) { if(!_factory.validateObject(obj)) {
/** * 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); }
/** * 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; } }
public synchronized Object borrowObject() throws Exception { assertOpen(); Object obj = null; boolean newlyCreated = false;