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?

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: To BlockingQueue or not to BlockingQueue?
Date 2015-11-14 17:08 -0500
Organization A noiseless patient Spider
Message-ID <n28b8q$6nd$1@dont-email.me> (permalink)
References <n24r35$f4s$1@dont-email.me> <mcmurtrie-63AE3A.16561813112015@news.sonic.net>

Show all headers | 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