Pool Server with and without using Erlang's supervisor
and gen_server
behaviours
Without generic behaviour implementation
In the app_1
there are 4 modules:
sv
acting as a dispatcher for messages from potential clientsmonitor
acting as supervisor (for theworker
) and also as agen_server
that can be queried bysv
regarding the state of itsworker
. This module forwards received messages to theworker
if itsfree
or places them in aqueue
for later dequeuing (when worker is ready)worker
the processing unit for the requestscommon
module that will contain reuseable logic