Concurrency problems ...

Marco Lettere <[email protected]>
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
Hello everyone,
I have a Java process that is subdivided in multiple threads.

Some of these threads produce messages that have to be sent to a queue 
and put them into a set of Vector (with synchronized access) called 
sendVectors.

There is also a  MessageListener thread that listens on a JMS topic (one 
connection and one session).
The onMessage method puts received messages into a Vector (with 
synchronized access) called receiveVector and then notifies the thread 
responsible for parsing messages. When the parser thread gets woken up 
it consumes first those messages  and sends then the messages that have 
been put into the sendVectors.

Occasionally this mechanism seems to loose messages and the whole 
process seems to be stuck. This happens in a very non-deterministic way 
so I fear it might be  a synchronization problem.

Where do I have exactly to start taking care of synchronization. I've 
read that sessions are not thread save but I think with the described 
mechanism I should avoid any problems on that. Am I missing something on 
this point?

Please note that I create one only queue session (and one only sender) 
plus one only topicSession (and one only receiver) at startup.

Thank you,
M.


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.