public class DDCFactory extends java.lang.Object implements PoolableObjectFactory
构造器和说明 |
---|
DDCFactory() |
限定符和类型 | 方法和说明 |
---|---|
void |
activateObject(java.lang.Object obj)
用于将对象“激活”――设置为适合开始使用的状态
|
void |
destroyObject(java.lang.Object obj)
用于销毁被validateObject判定为已失效的对象
|
java.lang.Object |
makeObject()
用于在必要时产生新的对象
|
void |
passivateObject(java.lang.Object obj)
用于将对象“挂起”――设置为适合开始休眠的状态
|
boolean |
validateObject(java.lang.Object obj)
用于校验一个具体的对象是否仍然有效,已失效的对象会被自动交给destroyObject方法销毁
|
public java.lang.Object makeObject() throws java.lang.Exception
makeObject
在接口中 PoolableObjectFactory
java.lang.Exception
- if there is a problem creating a new instance,
this will be propagated to the code requesting an object.public void activateObject(java.lang.Object obj) throws java.lang.Exception
activateObject
在接口中 PoolableObjectFactory
obj
- the instance to be activatedjava.lang.Exception
- if there is a problem activating obj
,
this exception may be swallowed by the pool.PoolableObjectFactory.destroyObject(T)
public void passivateObject(java.lang.Object obj) throws java.lang.Exception
passivateObject
在接口中 PoolableObjectFactory
obj
- the instance to be passivatedjava.lang.Exception
- if there is a problem passivating obj
,
this exception may be swallowed by the pool.PoolableObjectFactory.destroyObject(T)
public boolean validateObject(java.lang.Object obj)
validateObject
在接口中 PoolableObjectFactory
obj
- the instance to be validatedfalse
if obj
is not valid and should
be dropped from the pool, true
otherwise.public void destroyObject(java.lang.Object obj) throws java.lang.Exception
destroyObject
在接口中 PoolableObjectFactory
obj
- the instance to be destroyedjava.lang.Exception
- should be avoided as it may be swallowed by
the pool implementation.PoolableObjectFactory.validateObject(T)
,
ObjectPool.invalidateObject(T)