Meaningless Drivel is fun!*
The moose likes Threads and Synchronization and the fly likes queue issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "queue issue" Watch "queue issue" New topic

queue issue

jack nicolson

Joined: Mar 07, 2008
Posts: 5

I am facing one issue with the LinkedBlockingQueue, I wrote two threads one producer and one consumer. These threads are running in the background. At a particular time the producer thread retrieves the data from the Database and sets the pojo objects. these objects put into queue.

Now, consumer thread retrieving the objects from queue, how ever its not happening, some times consumer retrieve one object from queue.

As of my understanding the consumer should retrieve the object from queue as soon as its put by the producer,

Both the thread are running continuously.

Jack *
Justin Yao

Joined: Jun 16, 2006
Posts: 19
How about show us your Producer and Consumer?

But you can take a look at the Producer and Comsumer pattern first.
Consider Paul's rocket mass heater.
subject: queue issue
Similar Threads
When utilizing all cores - speed of execution decrease significantly. Why?
Multithreaded Example... Where to put WAIT() , NOTIFY() advise please
Threads question from Kahalid's exam..
My Locking Strategy...