1 16 17 package org.apache.commons.pool.impl; 18 19 import org.apache.commons.pool.ObjectPool; 20 import org.apache.commons.pool.ObjectPoolFactory; 21 import org.apache.commons.pool.PoolableObjectFactory; 22 23 32 public class StackObjectPoolFactory implements ObjectPoolFactory { 33 public StackObjectPoolFactory() { 34 this((PoolableObjectFactory)null,StackObjectPool.DEFAULT_MAX_SLEEPING,StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY); 35 } 36 37 public StackObjectPoolFactory(int max) { 38 this((PoolableObjectFactory)null,max,StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY); 39 } 40 41 public StackObjectPoolFactory(int max, int init) { 42 this((PoolableObjectFactory)null,max,init); 43 } 44 45 public StackObjectPoolFactory(PoolableObjectFactory factory) { 46 this(factory,StackObjectPool.DEFAULT_MAX_SLEEPING,StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY); 47 } 48 49 public StackObjectPoolFactory(PoolableObjectFactory factory, int max) { 50 this(factory,max,StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY); 51 } 52 53 public StackObjectPoolFactory(PoolableObjectFactory factory, int max, int init) { 54 _factory = factory; 55 _maxSleeping = max; 56 _initCapacity = init; 57 } 58 59 public ObjectPool createPool() { 60 return new StackObjectPool(_factory,_maxSleeping,_initCapacity); 61 } 62 63 protected PoolableObjectFactory _factory = null; 64 protected int _maxSleeping = StackObjectPool.DEFAULT_MAX_SLEEPING; 65 protected int _initCapacity = StackObjectPool.DEFAULT_INIT_SLEEPING_CAPACITY; 66 67 } 68 | Popular Tags |