我有一個Java進程,通過JInterface發送我的erlang gen_server消息。發送給我的消息包括在Java端創建的郵箱的Pid。該Pid是有效的,因爲我可以將消息發送回該Pid,並且這些消息已成功存入Javan端郵箱。可以通過JInterface監控代表Java郵箱的郵箱Pid嗎?
然而,做一個監視器(process,Pid)產生一個即時nodedown消息(noproc)。
有沒有辦法監控這個Pid?
我有一個Java進程,通過JInterface發送我的erlang gen_server消息。發送給我的消息包括在Java端創建的郵箱的Pid。該Pid是有效的,因爲我可以將消息發送回該Pid,並且這些消息已成功存入Javan端郵箱。可以通過JInterface監控代表Java郵箱的郵箱Pid嗎?
然而,做一個監視器(process,Pid)產生一個即時nodedown消息(noproc)。
有沒有辦法監控這個Pid?
Java(和C)節點與Erlang節點不同。它們是隱藏的,它們不會實現Erlang節點所做的一切。特別是,他們不實現監視器支持。
這是記錄與Erlang Distribution Protocol:
11.7新Ctrlmessages爲distrvsn = 4(OTP R6)
這些僅由Erlang節點識別,而不是由隱藏節點。
MONITOR_P
...
OTP實現用於上(僞)執行呼叫的監視回退機制-gen_servers這樣的節點上。 comment有啓發性:
%% Node (C/Java?) is not supporting the monitor.
%% The other possible case -- this node is not distributed
%% -- should have been handled earlier.
%% Do the best possible with monitor_node/2.
%% This code may hang indefinitely if the Process
%% does not exist. It is only used for featureweak remote nodes.
Java郵箱發送退出信號並斷開與它的任何鏈接,但據我所知不支持監視器。所以你可以鏈接到它,只要小心,因爲鏈接是雙向的。