Startup phase design
Gerd Flaig
gerd@REDACTED
Fri May 6 12:01:31 CEST 2005
Hi,
the service module foo in my application is implemented as a set of
functions calling a gen_server, like this:
frob() ->
gen_server:call(frobserv, frobnicate).
Frobserv is started during node startup via an application
supervisor. Java nodes regularly connect and call foo:frob(). The
problem is, those Java nodes also connect when the gen_server is not
yet fully started, causing noproc crashes.
Three solutions come to my mind:
1. Don't use Erlang distribution between the Java and Erlang
nodes. Communicate over a specialized protocol over TCP, open the
listening port only when the application is ready. This solution
seems to be the most clean one to me but would require the most
effort.
2. Signal a temporary failure to the caller but don't crash.
3. Block calls until frobserv is up.
What do you think? Is there another, maybe better way? I am not sure
what would be the best way to implement 2. or 3. if I don't get
permission to implement solution 1.
Goodbyte, Gerd.
--
Gerd Flaig Technik gerd@REDACTED
Bei Schlund + Partner AG Brauerstraße 48 D-76135 Karlsruhe
Physics is like sex: sure, it may give some practical results,
but that's not why we do it. -- Richard Feynman
More information about the erlang-questions
mailing list