01: package org.huihoo.jfox.pool;
02:
03: /**
04: *
05: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
06: */
07:
08: public class Test {
09:
10: public static void main(String[] args) throws Exception {
11: ObjectPool pool = new SimpleObjectPool(
12: ObjectFactorySupport.class.getName(),
13: TestPoolableObject.class.getName(), 10, 20); // PoolManager.createPool(new ObjectFactorySupport(TestPoolableObject.class));
14:
15: pool.init();
16:
17: System.out.println("Working: " + pool.getWorking() + ", Rest: "
18: + pool.getRest());
19:
20: TestPoolableObject tpobj = (TestPoolableObject) pool
21: .retrieveObject();
22:
23: System.out.println("Working: " + pool.getWorking() + ", Rest: "
24: + pool.getRest());
25:
26: System.out.println("word from pool: " + tpobj.say());
27:
28: pool.restoreObject(tpobj);
29:
30: System.out.println("Working: " + pool.getWorking() + ", Rest: "
31: + pool.getRest());
32:
33: }
34:
35: }
|