Package org.apache.commons.pool2
Class BasePooledObjectFactory<T>
java.lang.Object
org.apache.commons.pool2.BaseObject
org.apache.commons.pool2.BasePooledObjectFactory<T>
- Type Parameters:
T
- Type of element managed in this factory.
- All Implemented Interfaces:
PooledObjectFactory<T>
public abstract class BasePooledObjectFactory<T>
extends BaseObject
implements 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
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
No-op.abstract T
create()
Creates an object instance, to be wrapped in aPooledObject
.void
No-op.Creates an instance that can be served by the pool and wrap it in aPooledObject
to be managed by the pool.void
No-op.boolean
Always returnstrue
.abstract PooledObject<T>
Wraps the provided instance with an implementation ofPooledObject
.Methods inherited from class org.apache.commons.pool2.BaseObject
toString, toStringAppendFields
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.commons.pool2.PooledObjectFactory
destroyObject
-
Constructor Details
-
BasePooledObjectFactory
public BasePooledObjectFactory()
-
-
Method Details
-
activateObject
No-op.- Specified by:
activateObject
in interfacePooledObjectFactory<T>
- Parameters:
p
- ignored- Throws:
Exception
- if there is a problem activatingobj
, this exception may be swallowed by the pool.- See Also:
-
create
Creates an object instance, to be wrapped in aPooledObject
.This method must support concurrent, multi-threaded invocation.
- Returns:
- an instance to be served by the pool, not null.
- 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:
destroyObject
in interfacePooledObjectFactory<T>
- Parameters:
p
- ignored- Throws:
Exception
- should be avoided as it may be swallowed by the pool implementation.- See Also:
-
makeObject
Description copied from interface:PooledObjectFactory
Creates an instance that can be served by the pool and wrap it in aPooledObject
to be managed by the pool.- Specified by:
makeObject
in interfacePooledObjectFactory<T>
- Returns:
- a
PooledObject
wrapping an instance that can be served by the pool, not null. - Throws:
Exception
- if there is a problem creating a new instance, this will be propagated to the code requesting an object.
-
passivateObject
No-op.- Specified by:
passivateObject
in interfacePooledObjectFactory<T>
- Parameters:
p
- ignored- Throws:
Exception
- if there is a problem passivatingobj
, this exception may be swallowed by the pool.- See Also:
-
validateObject
Always returnstrue
.- Specified by:
validateObject
in interfacePooledObjectFactory<T>
- Parameters:
p
- ignored- Returns:
true
-
wrap
Wraps the provided instance with an implementation ofPooledObject
.- Parameters:
obj
- the instance to wrap, should not be null.- Returns:
- The provided instance, wrapped by a
PooledObject
-