T
- Type of element managed in this factory.public abstract class BasePooledObjectFactory<T> extends Object implements PooledObjectFactory<T>
PoolableObjectFactory
.
All operations defined here are essentially no-op's.
This class is immutable, and therefore thread-safe
PooledObjectFactory
,
BaseKeyedPooledObjectFactory
Constructor and Description |
---|
BasePooledObjectFactory() |
Modifier and Type | Method and Description |
---|---|
void |
activateObject(PooledObject<T> p)
No-op.
|
abstract T |
create()
Creates an object instance, to be wrapped in a
PooledObject . |
void |
destroyObject(PooledObject<T> p)
No-op.
|
PooledObject<T> |
makeObject()
Create an instance that can be served by the pool and wrap it in a
PooledObject to be managed by the pool. |
void |
passivateObject(PooledObject<T> p)
No-op.
|
boolean |
validateObject(PooledObject<T> p)
This implementation always returns
true . |
abstract PooledObject<T> |
wrap(T obj)
Wrap the provided instance with an implementation of
PooledObject . |
public abstract T create() throws Exception
PooledObject
.
This method must support concurrent, multi-threaded activation.
Exception
- if there is a problem creating a new instance,
this will be propagated to the code requesting an object.public abstract PooledObject<T> wrap(T obj)
PooledObject
.obj
- the instance to wrapPooledObject
public PooledObject<T> makeObject() throws Exception
PooledObjectFactory
PooledObject
to be managed by the pool.makeObject
in interface PooledObjectFactory<T>
PooledObject
wrapping an instance that can be served by the poolException
- if there is a problem creating a new instance,
this will be propagated to the code requesting an object.public void destroyObject(PooledObject<T> p) throws Exception
destroyObject
in interface PooledObjectFactory<T>
p
- ignoredException
- should be avoided as it may be swallowed by
the pool implementation.PooledObjectFactory.validateObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
,
ObjectPool.invalidateObject(T)
public boolean validateObject(PooledObject<T> p)
true
.validateObject
in interface PooledObjectFactory<T>
p
- ignoredtrue
public void activateObject(PooledObject<T> p) throws Exception
activateObject
in interface PooledObjectFactory<T>
p
- ignoredException
- if there is a problem activating obj
,
this exception may be swallowed by the pool.PooledObjectFactory.destroyObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
public void passivateObject(PooledObject<T> p) throws Exception
passivateObject
in interface PooledObjectFactory<T>
p
- ignoredException
- if there is a problem passivating obj
,
this exception may be swallowed by the pool.PooledObjectFactory.destroyObject(org.apache.tomcat.dbcp.pool2.PooledObject<T>)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.