1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 /***
24 * A factory for creating {@link StackObjectPool} instances.
25 *
26 * @see StackObjectPool
27 * @see StackKeyedObjectPoolFactory
28 *
29 * @author Rodney Waldhoff
30 * @version $Revision: 155430 $ $Date: 2005-02-26 08:13:28 -0500 (Sat, 26 Feb 2005) $
31 */
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 }