Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33129

Re: To BlockingQueue or not to BlockingQueue?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: To BlockingQueue or not to BlockingQueue?
Date Sat, 14 Nov 2015 17:08:27 -0500
Organization A noiseless patient Spider
Lines 31
Message-ID <n28b8q$6nd$1@dont-email.me> (permalink)
References <n24r35$f4s$1@dont-email.me> <mcmurtrie-63AE3A.16561813112015@news.sonic.net>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sat, 14 Nov 2015 22:06:18 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="6893"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1955TECmBiSwd1sgCdwzgdN"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
In-Reply-To <mcmurtrie-63AE3A.16561813112015@news.sonic.net>
Cancel-Lock sha1:zwDOSk01vpN3EYCyPz/ZUBcdgE0=
Xref csiph.com comp.lang.java.programmer:33129

Show key headers only | View raw


On 11/13/2015 7:56 PM, Kevin McMurtrie wrote:
> In article <n24r35$f4s$1@dont-email.me>,
>   Eric Sosman <esosman@comcast-dot-net.invalid> wrote:
>> [...]
>>       Eventually I settled on a plain Queue with explicit synchronization:
>> very old-fashioned and out of style, I know, but I couldn't think of a
>> way to do things in a more modern mode.  It doesn't seem to me that my
>> goals #1,2,3 are outrageously weird, and there *ought* to be a way to
>> satisfy them without making myself look like a refugee from the last
>> millennium.  Does anyone have suggestions?
>
> The good old synchronization block shouldn't be avoided just because
> it's not trendy.  When making complex decisions or performing actions
> that can't easily be undone, blocking is often the better choice.
>
> Your problem here is the need for #3 and some sucky Sun code.  The Java
> queue/dequeue interfaces completely lack signaling.  There's no error
> signal, no end of stream signal, and no abort signal.  Attempting to
> pass those signals outside of the queue/dequeue results in race
> conditions.

     Thanks, Kevin.  My references to using "old hat" approaches
were a bit tongue-in-cheek, poking fun at my own inability to find
a java.util.concurrent solution to what seemed a simple problem.
If you, too, see no solution, then I feel less inadequate.  ;)

     "Sometimes the old ways are best."

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

To BlockingQueue or not to BlockingQueue? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-13 09:13 -0500
  Re: To BlockingQueue or not to BlockingQueue? Eric Douglas <e.d.programmer@gmail.com> - 2015-11-13 07:29 -0800
    Re: To BlockingQueue or not to BlockingQueue? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-13 10:41 -0500
      Re: To BlockingQueue or not to BlockingQueue? Eric Douglas <e.d.programmer@gmail.com> - 2015-11-13 07:57 -0800
  Re: To BlockingQueue or not to BlockingQueue? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-11-13 16:56 -0800
    Re: To BlockingQueue or not to BlockingQueue? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-14 17:08 -0500
  Re: To BlockingQueue or not to BlockingQueue? Arne Vajhøj <arne@vajhoej.dk> - 2015-11-13 21:40 -0500
    Re: To BlockingQueue or not to BlockingQueue? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-14 17:24 -0500
      Re: To BlockingQueue or not to BlockingQueue? Arne Vajhøj <arne@vajhoej.dk> - 2015-11-14 19:13 -0500
  Re: To BlockingQueue or not to BlockingQueue? Steven Simpson <ss@my.domain.invalid> - 2015-11-15 10:37 +0000
  Re: To BlockingQueue or not to BlockingQueue? Sebastian <news@seyweiler.dyndns.org> - 2015-11-16 01:00 +0100

csiph-web