ObjectPool defines a trivially simple pooling interface. The only
required methods are borrowObject and returnObject .
Example of use:
Object obj = null;
try {
obj = pool.borrowObject();
//...use the object...
} catch(Exception e) {
//...handle any exceptions...
} finally {
// make sure the object is returned to the pool
if(null != obj) {
pool.returnObject(obj);
}
}
ObjectPooldefines a trivially simple pooling interface. The only required methods are borrowObject and returnObject .Example of use:
Object obj = null; try { obj = pool.borrowObject(); //...use the object... } catch(Exception e) { //...handle any exceptions... } finally { // make sure the object is returned to the pool if(null != obj) { pool.returnObject(obj); } }