[erlang-questions] jinterface (was: otp.net)

Paul Guyot pguyot@REDACTED
Sat Oct 4 15:14:09 CEST 2008

> Date: Sat, 04 Oct 2008 01:32:55 -0400
> From: Serge Aleynikov <saleyn@REDACTED>
> Subject: Re: [erlang-questions] jinterface (was: otp.net)
> I tried a similar test using jinterface to see if it's possible to
> monitor processes running on a Java node and ran into the same  
> failure.
> Can anyone explain what's wrong?
> (server@REDACTED)10> {test, client@REDACTED} ! {self(), hello}.
> {<0.45.0>,hello}
> (server@REDACTED)11> f(), {Pid, _} = receive M -> M end.
> {<5979.1.0>,hello}
> (server@REDACTED)12> erlang:monitor(process, Pid).
> ** exception error: bad argument
>       in function  erlang:monitor/2
>          called as erlang:monitor(process,<5979.1.0>)

I've seen a comment in stdlib/gen.erl, at line 196, that suggests  
that Java and C nodes are featureweak, and processes in such nodes  
cannot be monitored. Instead, you have to monitor the whole node with  
monitor_node/2. This makes sense because the OTP ei (C library) or  
jinterface do not monitor "processes". Indeed, there is only one pid  
per node, which is the node's pseudo-pid (even if technically, each  
connection can receive messages). I guess you can draw from the code  
in gen.erl if you need to monitor either an erlang process or your  
java process, or just monitor the node if you only need to monitor  
java processes.



More information about the erlang-questions mailing list