Sign in or 

|
admandrila |
getMessageListener not working on OC4J (with JMS 1.1)
Feb 27 2009, 7:57 AM EST
HelloI'm working on a C client of JMS implemented via JNI and I have problems on Java part - (I don't have great experience with Java). I'm implementing the MessageListener. On the OnMessage() method I'm putting the current thread in a sleep mode before making the message.acknowledge(); This is done with: while(pause){ Thread.sleep(1); } The "pause" variable is initially set to true. I'm doing this sleep on the MessageListener's thread in order to be sure that the message is committed on the C part of the program before committing it on the JMS provider in order to be synchronized with JMS JVM related to messages. On a different thread (after the message was committed in C part), I'm getting the consumer and I want to get the message listener in order to set the "pause" to false, in order to let the MessageListener to resume its code. Once I get the messageListener, I can set the "pause" variable to false via a synchronized method of MessageListener. But I am not able to get the MessageListener - the current thread gets blocked at the line: MessageListenerImpl listener = (MessageListenerImpl)messageConsumer.getMessageListener(); I don't get an exception, nothing... I've tried also with wait() and notify() but I get the same behaviour. It seems like the MessageListener reference can't be taken from a separate thread (to make notify on it) when in sleep mode in OnMessage(). Providers used in tests are OC4J 9.0.4 and OC4J 10.1.3.40 Any suggestion is welcomed. Thanks and Regards, Alex Do you find this valuable?
Keyword tags:
None
|