devinus/poolboy — pull request #6 by kevsmith (2011-11-10 21:27:55+00:00)
Title: Added init and stop funs to poolboy's config

Added init_fun and stop_fun to poolboy's config proplist.
These functions are used to init and stop workers as they're
added and removed from a pool. These functions allow poolboy
to pool processes which need additional processing before they
are ready to be added or removed from the pool without requiring
the developer to write wrappers for the code executing in the pooled
processes.

The motivation for adding these functions is the case where poolboy
is managing a pool of database connection processes. These processes
need to load prepared statements immediately after they are created
and before they are placed in the pool. Prior to adding these functions
the only way to pool these processes was to wrap them in additional code
to handle the post-connection initialization. These functions now
permit poolboy to pool the database connections without wrapping them.