Object pool with the ability save objects on exit and reload on start?

216 Views Asked by At

Apache Commons seems to be the decent Object Pool implementation out there. Or any other framework that could support the cause

How Can I save its state of the pool during shutdown; may be serialize its objects to a external form json, xml ..? and reload during next startup ?

1

There are 1 best solutions below

0
On BEST ANSWER

It is possible to capture objects in a pool when the pool is closed and put these objects back in the pool when a pool is opened with Yapool. I added a test-case to Yapool that shows how this could be done.

Persisting these objects "between pools" is not part of Yapool. But you can, for example, store them in a file and load them before a pool is opened.

Update: added another test-case which shows a more proper implementation and also shows a corner-case.