org.huihoo.jfox.pool
Class SimpleIndexedObjectPool
java.lang.Object
org.huihoo.jfox.system.ComponentSupport
org.huihoo.jfox.pool.IndexedObjectPoolSupport
org.huihoo.jfox.pool.SimpleIndexedObjectPool
- All Implemented Interfaces:
- Component, IndexedObjectPool, Loggable, Persistentable, java.io.Serializable
- public class SimpleIndexedObjectPool
- extends IndexedObjectPoolSupport
- See Also:
- Serialized Form
|
Method Summary |
void |
clear()
Clears any objects sitting idle in the pool, releasing any associated resources |
protected void |
doDestroy()
do actually destory action |
protected void |
doInit()
do actually create action |
static void |
main(java.lang.String[] args)
|
boolean |
removeObject(java.lang.Object key)
remove a poolable object from the pool |
boolean |
restoreObject(java.lang.Object key,
PoolableObject obj)
restore the retrived object to object pool |
PoolableObject |
retrieveObject(java.lang.Object key)
retrieve Object from object pool with the key
如果这个 key 还不存在,就新建该 key ,并返回和该 key 关联的对象 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleIndexedObjectPool
public SimpleIndexedObjectPool(ObjectFactory factory)
SimpleIndexedObjectPool
public SimpleIndexedObjectPool(java.lang.String objectFactoryClassName,
java.lang.String poolableClassName)
doInit
protected void doInit()
throws java.lang.Exception
- Description copied from class:
ComponentSupport
- do actually create action
- Overrides:
doInit in class IndexedObjectPoolSupport
- Throws:
java.lang.Exception
doDestroy
protected void doDestroy()
throws java.lang.Exception
- Description copied from class:
ComponentSupport
- do actually destory action
- Overrides:
doDestroy in class IndexedObjectPoolSupport
- Throws:
java.lang.Exception
clear
public void clear()
- Description copied from interface:
IndexedObjectPool
- Clears any objects sitting idle in the pool, releasing any associated resources
- Specified by:
clear in interface IndexedObjectPool- Overrides:
clear in class IndexedObjectPoolSupport
retrieveObject
public PoolableObject retrieveObject(java.lang.Object key)
throws java.lang.Exception
- Description copied from interface:
IndexedObjectPool
- retrieve Object from object pool with the key
如果这个 key 还不存在,就新建该 key ,并返回和该 key 关联的对象
- Returns:
-
- Throws:
java.lang.Exception
restoreObject
public boolean restoreObject(java.lang.Object key,
PoolableObject obj)
- Description copied from interface:
IndexedObjectPool
- restore the retrived object to object pool
- Returns:
- true if success, false if failed
removeObject
public boolean removeObject(java.lang.Object key)
- Description copied from interface:
IndexedObjectPool
- remove a poolable object from the pool
- Parameters:
key -
- Returns:
main
public static void main(java.lang.String[] args)