File Information
Library: Foundation
Package: Core
Header: Poco/ObjectPool.h
Description
A PoolableObjectFactory is responsible for creating and resetting objects managed by an ObjectPool.
Together with an ObjectPool, a PoolableObjectFactory is used as a policy class to change the behavior of the ObjectPool when creating new objects, returning used objects back to the pool and destroying objects, when the pool itself is destroyed or shrunk.
Member Summary
Member Functions: activateObject, createObject, deactivateObject, destroyObject, validateObject
Member Functions
activateObject
void activateObject(
P pObject
);
Called before an object is handed out by the pool. Also called for newly created objects, before they are given out for the first time.
createObject
P createObject();
Create and return a new object.
deactivateObject
void deactivateObject(
P pObject
);
Called after an object has been given back to the pool and the object is still valid (a prior call to validateObject() returned true).
To maintain the integrity of the pool, this method must not throw an exception.
destroyObject
void destroyObject(
P pObject
);
Destroy an object.
To maintain the integrity of the pool, this method must not throw an exception.
validateObject
bool validateObject(
P pObject
);
Checks whether the object is still valid and can be reused.
Returns true if the object is valid, false otherwise.
To maintain the integrity of the pool, this method must not throw an exception.