Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Making one or more threads wait for another to produce a value or fail Date: Tue, 31 May 2011 08:26:13 -0700 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 31 May 2011 15:26:26 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="OmuYOEO5yndXCozdWzkVJQ"; logging-data="13969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/H98sH8diLcgzR726Ls2XDrNyj8Laz4go=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:1bjSlt8oZ1bV9F+ryWPi5dfpoqA= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4799 On 5/31/2011 7:00 AM, Tom Anderson wrote: > A blocking queue does synchronisation and delivers a value, but it only > delivers the value once - if the suitors all queue up on take(), only > the first will get the verdict. You could go around this by adding all threads to a list, and interrupting all the ones to get the exceptional verdict. Is there an values associated with the exceptional verdict? Also, what happens if a new suitor appears just as, or just after, the widow delivers her verdict? Do new or late suitors get the exceptional verdict, or do they get queued up for some other process? And lastly, are the verdicts immutable, in terms of being an immutable Java object? Can I just make a couple of objects (one verdict, one exception) and hand them out to all and sundry? It's the end of the month, and I'm packing to move. I might not get back to this thread for a couple of days. In the meantime, good luck.