Class BasePooledObjectFactory<T>
java.lang.Object
org.apache.commons.pool2.BasePooledObjectFactory<T>
- Type Parameters:
T- Type of element managed in this factory.
- All Implemented Interfaces:
PooledObjectFactory<T>
A base implementation of
PoolableObjectFactory.
All operations defined here are essentially no-op's.
This class is immutable, and therefore thread-safe
- Since:
- 2.0
- Version:
- $Revision: 1333925 $
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNo-op.abstract Tcreate()Creates an object instance, to be wrapped in aPooledObject.voidNo-op.Create an instance that can be served by the pool and wrap it in aPooledObjectto be managed by the pool.voidNo-op.booleanThis implementation always returnstrue.abstract PooledObject<T> Wrap the provided instance with an implementation ofPooledObject.
-
Constructor Details
-
BasePooledObjectFactory
public BasePooledObjectFactory()
-
-
Method Details
-
create
Creates an object instance, to be wrapped in aPooledObject.This method must support concurrent, multi-threaded activation.
- Returns:
- an instance to be served by the pool
- Throws:
Exception- if there is a problem creating a new instance, this will be propagated to the code requesting an object.
-
wrap
Wrap the provided instance with an implementation ofPooledObject.- Parameters:
obj- the instance to wrap- Returns:
- The provided instance, wrapped by a
PooledObject
-
makeObject
Description copied from interface:PooledObjectFactoryCreate an instance that can be served by the pool and wrap it in aPooledObjectto be managed by the pool.- Specified by:
makeObjectin interfacePooledObjectFactory<T>- Returns:
- a
PooledObjectwrapping an instance that can be served by the pool - Throws:
Exception- if there is a problem creating a new instance, this will be propagated to the code requesting an object.
-
destroyObject
No-op.- Specified by:
destroyObjectin interfacePooledObjectFactory<T>- Parameters:
p- ignored- Throws:
Exception- should be avoided as it may be swallowed by the pool implementation.- See Also:
-
validateObject
This implementation always returnstrue.- Specified by:
validateObjectin interfacePooledObjectFactory<T>- Parameters:
p- ignored- Returns:
true
-
activateObject
No-op.- Specified by:
activateObjectin interfacePooledObjectFactory<T>- Parameters:
p- ignored- Throws:
Exception- if there is a problem activatingobj, this exception may be swallowed by the pool.- See Also:
-
passivateObject
No-op.- Specified by:
passivateObjectin interfacePooledObjectFactory<T>- Parameters:
p- ignored- Throws:
Exception- if there is a problem passivatingobj, this exception may be swallowed by the pool.- See Also:
-