Multiple sends doesn't seem to work because of ThreadedMessageListener?

Jon Priddey <[email protected]> Fri, 07 Feb 2003 11:49:55 +0000
Newsgroups gmane.network.beep.beepcore.java.general
Message-ID <[email protected]>
I've just subscribed and I note from the archive that a problem like 
this has been noted, but perhaps not resolved.

My code tries:

channel.sendMSG(msg1,reply1);
channel.sendMSG(msg2,reply2);
channel.sendMSG(msg3,reply3);

then I try to read the replies. I've also tried using reply1 three times.

The problem appears to be with ThreadedMessageListener, which assigns 
the received message to a field before spawning a thread to process the 
message.

public void receiveMSG(Message message) // simplified
{
   this.message = (MessageMSG)message;
   callbackQueue.execute(this);
}

If another message is received before the first is processed it 
overwrites the field. For this reason, I get "Incorrect message number: 
was 3; expecting 1".

I'm pulling down the CVS copy to try this fix:

public void receiveMSG(Message message) // simplified
{
   callbackQueue.execute(new MessageProcessor(message));
}

where a new MessageProcessor inner class holds the original run().

Comments welcome; should this parallel messaging in a single channel 
work in the first place? - I can't find any examples.

Regards, Jon.



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com