Design pattern for 1 Producer/multiple Consumers?

P

Paul Tomblin

I'm doing a simple Producer/Consumer thing based on the example in the Sun
docs, where the Consumer does a wait until there is something to consume,
then it consumes it and does a notify, and the Producer does a wait until
there is nothing to consume and then adds it and does a notify. But now I
need a bunch of Consumers. Is there a standard design pattern for this,
or am I going to have to figure it out myself?
 
P

Patrick May

[email protected] (Paul Tomblin) said:
I'm doing a simple Producer/Consumer thing based on the example in
the Sun docs, where the Consumer does a wait until there is
something to consume, then it consumes it and does a notify, and the
Producer does a wait until there is nothing to consume and then adds
it and does a notify. But now I need a bunch of Consumers. Is
there a standard design pattern for this, or am I going to have to
figure it out myself?

This is a standard JavaSpaces' Master-Worker pattern. See
http://www.jini.org for general information on JavaSpaces and just
Google "javaspaces master worker" for numerous examples.

Regards,

Patrick
 
H

Hunter Gratzner

L

Lew

Paul said:
I knew there was a reason why I liked Java 1.5.

There are several idioms. /Java Concurrency in Practice/ by Brian Goetz, et
al., discusses a few of them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top