2

I have created GenericPool by extending GenericObjectPool and poolFactory using BasePooledObjectFactory. Now I want to remove the object from my Generic Pool.

.clear() will remove idleObject from pool how do we remove permanently from the pool?

keepAlive
  • 6,369
  • 5
  • 24
  • 39

1 Answers1

0

Your poolFactory must implement the method

void destroyObject(PooledObject<T> p) throws Exception;

While your code should be calling method

public void invalidateObject(final T obj) throws Exception

on the GenericPool

At runtime, if you run into an exception situation (perhaps caused by a temp network issue) you need to remove the object from the pool and re-create it, so calling invalidateObject will destroy this object and automatically create new one when you call borrowObject