<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">You may want to take a look at Poolboy, it looks pretty good: <a href="https://github.com/devinus/poolboy" target="_blank" style="color: rgb(0, 0, 204); ">https://github.com/devinus/poolboy</a><div>
<br></div><div>It includes an example of pgsql connection pool.<div><div><div><div><div><div><br></div><div><font color="#888888">Anton</font></div></div></div></div></div></div></div></span><br><div class="gmail_quote">On Thu, Aug 4, 2011 at 2:01 AM, Andrew Berman <span dir="ltr"><<a href="mailto:rexxe98@gmail.com">rexxe98@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I'm fairly new to Erlang and I am trying to write a process pool which<br>
essentially is a connection pool to a database. I have designed the<br>
application like this: The main pool gen_server has a queue of PIDs<br>
of gen_fsm's. Each gen_fsm calls spawn_links a 3rd party gen_server and carries<br>
the state of the connection. So the 3rd party gen_server and the<br>
gen_fsm should always live and die together. I currently have set it<br>
up such that gen_fsm calls proc_lib:spawn_link() to start the 3rd<br>
party gen_server, but I'm wondering how this factors into the<br>
supervision tree. I currently have two supervisors:<br>
<br>
Sup1 -> one_for_all -> 2 children: pool gen_server and Sup2<br>
Sup2 -> simple_one_for_one -> 1 child: gen_fsm<br>
<br>
So my question is: is it ok to use spawn_link instead of somehow<br>
trying to put the 3rd party gen_server into the supervision tree? If<br>
it should go into the supervision tree, how would I organize the tree<br>
then such that the gen_fsm and 3rd party gen_server are reliant on<br>
each other?<br>
<br>
Thanks for any help!<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br>