org.huihoo.jfox.pool
Class SimpleIndexedObjectPool

java.lang.Object
  extended byorg.huihoo.jfox.system.ComponentSupport
      extended byorg.huihoo.jfox.pool.IndexedObjectPoolSupport
          extended byorg.huihoo.jfox.pool.SimpleIndexedObjectPool
All Implemented Interfaces:
Component, IndexedObjectPool, Loggable, Persistentable, java.io.Serializable

public class SimpleIndexedObjectPool
extends IndexedObjectPoolSupport

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.huihoo.jfox.pool.IndexedObjectPoolSupport
factory, pool
 
Fields inherited from class org.huihoo.jfox.system.ComponentSupport
logger, name, proxyInstance, sequence, state
 
Constructor Summary
SimpleIndexedObjectPool(ObjectFactory factory)
           
SimpleIndexedObjectPool(java.lang.String objectFactoryClassName, java.lang.String poolableClassName)
           
 
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 org.huihoo.jfox.pool.IndexedObjectPoolSupport
getObjectFactory, getRest, getWorking
 
Methods inherited from class org.huihoo.jfox.system.ComponentSupport
destroy, getLogger, getName, getState, init, parseName, setLogger, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleIndexedObjectPool

public SimpleIndexedObjectPool(ObjectFactory factory)

SimpleIndexedObjectPool

public SimpleIndexedObjectPool(java.lang.String objectFactoryClassName,
                               java.lang.String poolableClassName)
Method Detail

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)