我如何拨打这样的电话:
order_cat(Pid, Name, Color, Desc) ->
gen_server:call(Pid, {order, Name, Color, Desc}).
像这样:
handle_call({order, Name, Color, Desc}, _From, Cats) ->
if Cats =:= [] ->
{reply, make_cat(Name, Color, Desc), Cats};
Cats =/= [] ->
{reply, hd(Cats), tl(Cats)}
end;
handle_call(terminate, _From, Cats) ->
{stop, normal, ok, Cats}.
通过使用 java 和 Jinterface 而不是第一个代码?我知道如何使用 Jinterface 向 pid 发送消息,但是我有一个处理它的接收语句。我想改用 OTP,但我不明白如何。