KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > pool > IndexableObjectPool


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.pool;
8
9 /**
10  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
11  */

12
13
14 public interface IndexableObjectPool {
15     /**
16      * retrieve Object from object pool with the key
17      * 如果这个 key 还不存在,就新建该 key ,并返回和该 key 关联的对象
18      *
19      * @return
20      */

21     PoolableObject retrieveObject(Object JavaDoc key) throws Exception JavaDoc;
22
23     /**
24      * restore the retrived object to object pool
25      *
26      * @return true if success, false if failed
27      */

28     boolean restoreObject(Object JavaDoc key, PoolableObject obj);
29
30     /**
31      * remove a poolable object from the pool
32      *
33      * @param key
34      * @return
35      */

36     boolean removeObject(Object JavaDoc key);
37
38     /**
39      * Clears any objects sitting idle in the pool, releasing any associated resources
40      */

41     void clear();
42
43     /**
44      * get the factory use to create new instances
45      */

46     ObjectFactory getObjectFactory();
47
48     /**
49      * get the count of working object
50      *
51      * @return
52      */

53     int getWorking();
54
55     /**
56      * get the count of rest object
57      *
58      * @return
59      */

60     int getRest();
61 }
Popular Tags