File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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.
I agree. Here's the link:
subject: queue issue
It's not a secret anymore!