Getting and releasing pool elements
To get a reference to a Poolable object from the Generic Pool, the application calls the method getPoolable(), as follows:
Poolable poolable = ((GenericPool)Service.readObject("GenericPool")).getPoolable();
The above method returns an instance of Poolable that is ready to be used.
Note The Poolable object is already initialized.
Once the application has finished using the Poolable object, it releases it back to the pool, as follows:
getService("GenericPool").releasePoolable(poolable);
When you call releasePoolable, the Generic Pool resets the Poolable object automatically.
See also