Communicating with Java node

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Tue May 21 08:56:53 CEST 2002


Hi all,

I have a problem that I can't find the cause, and hope someone might know 
the answer.

I have an Erlang and a Java node communicating with each other. I noticed 
that if an Erlang process sends many messages to a Java process, then it is 
sometimes being slowed down, as if it was waiting for some response (which 
is not the case). The delay occurs when the Java process, upon receiving the 
message, writes something to the console... The difference for 1000 messages 
is ~500 ms when Java only reads the msg, and ~2200 ms when the receive is 
followed by an System.out.println. The delay seems to be independent of how 
much text is written.

Is it something that I do wrong, or is it normal behaviour, or is there a 
bug? Thanks in advance,

Vlad

Erlang code:
-module(tt).
-compile(export_all).
go(0)-> ok;
go(N) -> {main, java@REDACTED} ! {self(), hello}, go(N-1).

shell> timer:tc(tt, go, [999]).

Java code:
import com.ericsson.otp.erlang.*;
class App {
	public static main(String[] args)
	{
	try {
		OtpErlangNode node = new OtpErlangNode("java");
		OtpErlangMbox mbox = node.createMbox("main");
		while(true)
		{
			OtpErlangObject msg = mbox.receive();
			// System.out.println("got: "+msg.toString());
		}
	} catch (Exception ex) {}
	}
}



_________________________________________________________________
Chatta med kompisar online, prova MSN Messenger: http://messenger.msn.com




More information about the erlang-questions mailing list