I have a GenericKeyedObjectPool in my application.
I can close it with the close method but how should I wait for the clients to return (and the pool destroys) every borrowed object to the pool?
I need something like ExecutorService.awaitTermination.
Create a wrapper for the
GenericKeyedObjectPoolwhich has the requiredawaitTerminationmethod. You can check thecloseand thereturnObjectcalls and decrement a latch if the pool is closed and every object was returned (= the total number of instances current borrowed from this pool is zero).