The function or class passed to a Pool
instance has to follow the following rules:
- It must be safe to call its constructor with no arguments.
- It must implement an
initObject
method. - It must implement a
releaseObject
method.
When you're done with an object, pass it to Pool#release()
, and it will be made available for re-use.