0

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 ?

3
  • 2
    Saving is not part of a Pooling framework's job. The main job is reusing resource/time intensive objects without creating them. If you want this feature however you can write your own implementation. Commented Jun 8, 2014 at 9:31
  • 1
    I added a test-case to Yapool (also an Object Pool implementation) which shows resources can be saved/restored. But you are on your own when it comes to persisting and loading these resources (e.g. to XML/json file). Commented Jun 13, 2014 at 14:19
  • @vanOekel wow this is exactly what I was looking for. can you write this as an answer, so I can reward you. Commented Jun 14, 2014 at 4:27

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.