how to call gen_server with JInterface
patrick
preichar@REDACTED
Mon Mar 22 16:38:41 CET 2010
Is it possible to access a gen_server with JInterface?
Here's an excerpt of my (global) gen_server:
-module(sys_man).
-behaviour(gen_server).
start() ->
gen_server:start_link({global, ?MODULE}, ?MODULE, [], []).
register({Pid, Mbx, Node}) ->
gen_server:call({global, ?MODULE}, {register, Pid, Mbx, Node}).
handle_call({register, Pid, Mbx, Node}, _From, Tab) ->
Reply = ets:insert(Tab, {Pid, Mbx, Node}),
{reply, Reply, Tab}.
%% snipp
... and here's the java snippet which (obviously) doesn't work
OtpNode otpNode = new OtpNode("javaNode@REDACTED", "ourCookie");
OtpMbox myMbox = otpNode.createMbox("myMbox");
OtpErlangObject[] o = new OtpErlangObject[4];
o[0] = new OtpErlangAtom("register");
o[1] = myMbox.self();
o[2] = new OtpErlangString("a string");
o[3] = new OtpErlangString("another");
OtpErlangTuple tuple = new OtpErlangTuple(o);
myMbox.send("sys_man", "pat@REDACTED", tuple);
thank you for any hints regarding (global/local) gen_server and JInterface.
Regards,
Patrick
More information about the erlang-questions
mailing list