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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
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: 114
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: 14687
    
  16

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: 114
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
Error when deploying an EAR on JBoss 5.1.0
Not consuming JMS messages after a certain no. of messages are processed
Singleton MDB in a clustered environment
@EJB annotation from servlet and JBoss