5
votes
3answers
155 views

How to implement consumer-producer with multiple consumers and multiple queues

Assume there are 1 producer P and 2 consumers C1 and C2. And there are 2 queues Q1 and Q2, both with a specific capacity. P will produce items and put it into Q1 and Q2 alternately. Item is produced ...
2
votes
2answers
100 views

Design issue: is this doable only with producer/consumer?

I'm trying to increase performance of indexing my lucene files. For this, I created a worker "LuceneWorker" that does the job. Given the code below, the 'concurrent' execution becomes significantly ...
1
vote
1answer
167 views

Java ScheduledExecutorService producer\consumer

I have the next project: Spring(3.2)-based Web application(Tomcat 7), in background I have several tasks. I have a queue with some information for processing. This queue is updating ...
0
votes
1answer
422 views

How to pass data between two threads spawned by ScheduledExecutorService in Android?

I' m trying to implement a producer-consumer pattern in Android via ScheduledExecutorService. So, I have created a producer worker thread which loads data from the web site and consumer thread which ...
2
votes
5answers
589 views

Thread pool where workers are both producers and consumers

I have an unbounded queue of jobs which can be processed asynchronously. The processing of each job may or may not trigger the creation of new jobs for this queue. I would like a pool of several ...
0
votes
3answers
345 views

How to use SynchronousQueue appropriately in producer-consumer model? [closed]

I wrote a test example of using SynchronousQueue in producer-consumer model. But it doesn't work well. Below are my codes: public class QueueTest { String input; int pos; ...
1
vote
1answer
462 views

java multi threaded application: thread.sleep(100) takes almost forever

I'm trying to fix an application, which sends out a number of emails to clients. The sending is done by a multi threaded java app (on the Producer-Consumer model), where the Producer calls down the ...
0
votes
1answer
3k views

Java example of using ExecutorService and PipedReader/PipedWriter (or PipedInputStream/PipedOutputStream) for consumer-producer

I'm looking for a simple producer - consumer implementation in Java and don't want to reinvent the wheel I couldn't find an example that uses both the new concurrency package and either of the Piped ...