[Beepcore-java-users] Multiple sends doesn't seem to work because of ThreadedMessageListener?
Status: Beta
Brought to you by:
huston
From: Jon P. <jo...@el...> - 2003-02-07 11:50:31
|
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. |