aspose file tools*
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
Author

queue issue

jack nicolson
Greenhorn

Joined: Mar 07, 2008
Posts: 5
Hi,

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
Greenhorn

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.
http://www.java2s.com/Code/Java/Threads/ProducerandComsumer.htm
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: queue issue