Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

out of sync problem?

 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thing puzzling me is : what is that queue doing in a message-driven bean ?
 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic