[erlang-questions] question: How can I confirm existence of a registered mbox on a Java node?

Robert Raschke rtrlists@REDACTED
Fri Nov 28 18:33:33 CET 2008


Hi,

I am starting a node using jinterface. Is there any easy way for my
Erlang process to test if the OtpMbox with a name is ready for
business?

I can start my Java node like this:
    OtpNode node = new OtpNode("my_node@REDACTED", "MyCookie");
    OtpMbox mbox = node.createMbox("mbox");

So, I can now send messages in Erlang using
    {mbox, 'my_node@REDACTED'} ! {self(), message}
and that works fine.

But I have a problem when first starting up. I can ping the node to
see if it has been created, that's ok. But I cannot seem to figure out
how to establish that 'mbox' on that node is ready to accept messages.

As far as I can see, I can try sending a message at any time, and if
it's not ready yet, the message goes into the ether. Is the only way
to do this, by doing:

wait_for_mbox() ->
    {mbox, 'my_node@REDACTED'} ! {self(), my_hand},
    receive
        your_hand -> ok;
    after 10
        wait_for_mbox()
    end.

and have the Java bit shake hands at the beginning?

Any pointers greatly appreciated,
Robby



More information about the erlang-questions mailing list