aspose file tools
The moose likes Threads and Synchronization and the fly likes out of sync problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "out of sync problem?" Watch "out of sync problem?" New topic
Author

out of sync problem?

Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 113
I have constructed a queue, to put incoming operations to be computed. So, when operation comes via onMessage method, it is put at end of ConcurrentLinkedQueue (was LinkedList earlier, but also was not working). After adding, I start (just once, after deploy) processing thread, which in interval is checking the list for operations to process. The problem is, that once per 2-3 days something goes wrong. I noticed, that operations are added correctly to the queue, however processing thread, sees the queue empty all the time. From the logs, there is no error. Could it be my queue is out of sync?


Here's the code


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

The thing puzzling me is : what is that queue doing in a message-driven bean ?


[My Blog]
All roads lead to JavaRanch
Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 113
The processing is very complex and I don't want situation when two or more operations are processed the same time. That's why I put a queue there and a thread for processing one by one. I used MDB so the operations are processed asynchronously, so my web app does not have to wait for the result.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: out of sync problem?
 
Similar Threads
[EJB3]MessageDriven bean never catch message
@EJB annotation from servlet and JBoss
Singleton MDB in a clustered environment
Not consuming JMS messages after a certain no. of messages are processed
Error when deploying an EAR on JBoss 5.1.0