Top Description Constructors Methods
org.apache.commons.pool2

public abstract Class BasePooledObjectFactory<T>

extends BaseObject
implements PooledObjectFactory<T>
Class Inheritance
All Implemented Interfaces
org.apache.commons.pool2.PooledObjectFactory
Type Parameters
<T>
Type of element managed in this factory.
Imports
java.util.Objects

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
PooledObjectFactory, BaseKeyedPooledObjectFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public abstract T

Returns:

an instance to be served by the pool, not null.
create
()

Creates an object instance, to be wrapped in a PooledObject.

public void
public PooledObject<T>
makeObject()

Implements org.apache.commons.pool2.PooledObjectFactory.makeObject.

Creates an instance that can be served by the pool and wrap it in a PooledObject to be managed by the pool.
public void
public boolean

Returns:

true
validateObject
(final PooledObject<T>
ignored
p
)

Implements org.apache.commons.pool2.PooledObjectFactory.validateObject.

Always returns true.
public abstract PooledObject<T>

Returns:

The provided instance, wrapped by a PooledObject
wrap
(T
the instance to wrap, should not be null.
obj
)

Wraps the provided instance with an implementation of PooledObject.

Inherited from org.apache.commons.pool2.BaseObject:
toStringtoStringAppendFields

Constructor Detail

BasePooledObjectFactoryback to summary
public BasePooledObjectFactory()

Method Detail

activateObjectback to summary
public void activateObject(final PooledObject<T> p) throws Exception

Implements org.apache.commons.pool2.PooledObjectFactory.activateObject.

No-op.

Parameters
p:PooledObject<T>

ignored

Annotations
@Override
Exceptions
Exception:

Doc from org.apache.commons.pool2.PooledObjectFactory.activateObject.

if there is a problem activating obj, this exception may be swallowed by the pool.

createback to summary
public abstract T create() throws Exception

Creates an object instance, to be wrapped in a PooledObject.

This method must support concurrent, multi-threaded invocation.

Returns:T

an instance to be served by the pool, not null.

Exceptions
Exception:
if there is a problem creating a new instance, this will be propagated to the code requesting an object.
destroyObjectback to summary
public void destroyObject(final PooledObject<T> p) throws Exception

Implements org.apache.commons.pool2.PooledObjectFactory.destroyObject.

No-op.

Parameters
p:PooledObject<T>

ignored

Annotations
@Override
Exceptions
Exception:

Doc from org.apache.commons.pool2.PooledObjectFactory.destroyObject.

should be avoided as it may be swallowed by the pool implementation.

makeObjectback to summary
public PooledObject<T> makeObject() throws Exception

Implements org.apache.commons.pool2.PooledObjectFactory.makeObject.

Doc from org.apache.commons.pool2.PooledObjectFactory.makeObject.

Creates an instance that can be served by the pool and wrap it in a PooledObject to be managed by the pool.

Returns:PooledObject<T>

a PooledObject wrapping an instance that can be served by the pool, not null.

Annotations
@Override
Exceptions
Exception:
if there is a problem creating a new instance, this will be propagated to the code requesting an object.
passivateObjectback to summary
public void passivateObject(final PooledObject<T> p) throws Exception

Implements org.apache.commons.pool2.PooledObjectFactory.passivateObject.

No-op.

Parameters
p:PooledObject<T>

ignored

Annotations
@Override
Exceptions
Exception:

Doc from org.apache.commons.pool2.PooledObjectFactory.passivateObject.

if there is a problem passivating obj, this exception may be swallowed by the pool.

validateObjectback to summary
public boolean validateObject(final PooledObject<T> p)

Implements org.apache.commons.pool2.PooledObjectFactory.validateObject.

Always returns true.

Parameters
p:PooledObject<T>

ignored

Returns:boolean

true

Annotations
@Override
wrapback to summary
public abstract PooledObject<T> wrap(T obj)

Wraps the provided instance with an implementation of PooledObject.

Parameters
obj:T

the instance to wrap, should not be null.

Returns:PooledObject<T>

The provided instance, wrapped by a PooledObject