T
- Type of element managed in this factory.public abstract class BasePooledObjectFactory<T> extends BaseObject 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()
Creates 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 . |
toString, toStringAppendFields
public abstract T create() throws java.lang.Exception
PooledObject
.
This method must support concurrent, multi-threaded activation.
java.lang.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 java.lang.Exception
PooledObjectFactory
PooledObject
to be managed by the pool.makeObject
in interface PooledObjectFactory<T>
PooledObject
wrapping an instance that can be served by the pooljava.lang.Exception
- 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 java.lang.Exception
destroyObject
in interface PooledObjectFactory<T>
p
- ignoredjava.lang.Exception
- 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 java.lang.Exception
activateObject
in interface PooledObjectFactory<T>
p
- ignoredjava.lang.Exception
- 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 java.lang.Exception
passivateObject
in interface PooledObjectFactory<T>
p
- ignoredjava.lang.Exception
- 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-2018 Apache Software Foundation. All Rights Reserved.