org.huihoo.jfox.pool
Class SimpleObjectPool
org.huihoo.jfox.service.ComponentSupport
|
+--org.huihoo.jfox.pool.AbstractObjectPool
|
+--org.huihoo.jfox.pool.SimpleObjectPool
- All Implemented Interfaces:
- Component, ComponentSupportMBean, Loggable, ObjectPool, ObjectPoolMBean, Persistentable, java.io.Serializable, SimpleObjectPoolMBean
- public class SimpleObjectPool
- extends AbstractObjectPool
- implements SimpleObjectPoolMBean
- Author:
- Young Yang
- See Also:
- Serialized Form
| Methods inherited from class org.huihoo.jfox.service.ComponentSupport |
destroy, getLogger, getName, getObjectName, getProxyInstance, getState, handleNotification, init, parseName, postDeregister, postRegister, preDeregister, preRegister, setLogger, setName |
SimpleObjectPool
public SimpleObjectPool(ObjectFactory factory)
SimpleObjectPool
public SimpleObjectPool(ObjectFactory factory,
int initNum,
int maxRest)
SimpleObjectPool
public SimpleObjectPool(java.lang.String objectFactoryClassName,
java.lang.String poolableClassName)
SimpleObjectPool
public SimpleObjectPool(java.lang.String objectFactoryClassName,
java.lang.String poolableClassName,
int initNum,
int maxRest)
retrieveObject
public PoolableObject retrieveObject()
throws java.lang.Exception
- retrieve Object from object pool
- Returns:
-
restoreObject
public boolean restoreObject(PoolableObject obj)
- restore the retrived object to object pool
- Returns:
- true if object passivate && push success, false if failed
removeObject
public boolean removeObject(PoolableObject obj)
- Description copied from interface:
ObjectPool
- remove a poolable object from the pool
- Following copied from interface:
org.huihoo.jfox.pool.ObjectPool
- Parameters:
obj - - Returns:
-
clear
public void clear()
- Description copied from interface:
ObjectPoolMBean
- Clears any objects sitting idle in the pool, releasing any associated resources
- Specified by:
clear in interface ObjectPoolMBean- Overrides:
clear in class AbstractObjectPool
getWorking
public int getWorking()
- Description copied from interface:
ObjectPoolMBean
- get the count of working object
- Specified by:
getWorking in interface ObjectPoolMBean- Overrides:
getWorking in class AbstractObjectPool
- Following copied from interface:
org.huihoo.jfox.pool.ObjectPoolMBean
- Returns:
-
getRest
public int getRest()
- Description copied from interface:
ObjectPoolMBean
- get the count of rest object
- Specified by:
getRest in interface ObjectPoolMBean- Overrides:
getRest in class AbstractObjectPool
- Following copied from interface:
org.huihoo.jfox.pool.ObjectPoolMBean
- Returns:
-
doInit
protected void doInit()
throws java.lang.Exception
- Description copied from class:
ComponentSupport
- do actually create action
- Overrides:
doInit in class AbstractObjectPool
doDestroy
protected void doDestroy()
throws java.lang.Exception
- Description copied from class:
ComponentSupport
- do actually destory action
- Overrides:
doDestroy in class AbstractObjectPool
getInitNum
public int getInitNum()
- Description copied from interface:
SimpleObjectPoolMBean
- 初始化池中对象的数目
- Specified by:
getInitNum in interface SimpleObjectPoolMBean
- Following copied from interface:
org.huihoo.jfox.pool.SimpleObjectPoolMBean
- Returns:
-
getMaxRest
public int getMaxRest()
- Description copied from interface:
SimpleObjectPoolMBean
- 池中对象最大的空闲数,超过这个空闲数之后,返回池的对象将不在池中保存
- Specified by:
getMaxRest in interface SimpleObjectPoolMBean
- Following copied from interface:
org.huihoo.jfox.pool.SimpleObjectPoolMBean
- Returns:
-
main
public static void main(java.lang.String[] args)