accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Havanki <bhava...@cloudera.com>
Subject Re: InterruptedException handling
Date Sun, 03 Nov 2013 00:21:12 GMT
That's a great article! Brian Goetz's book Java Concurrency in Practice has
material like this and *tons* more. That book along with Effective Java by
Bloch oughta be on every Java developer's bookshelf. :)

UtilWaitThread looks to me like it exists just to provide a sleep that eats
InterruptedException so you don't have to deal with it, which is pretty
much a bad idea. It prevents threads who use it from properly dying out
when receiving an interrupt. Eventually the method should be eliminated so
that threads can correctly propagate interrupts as the article describes.

Bill


On Fri, Nov 1, 2013 at 10:52 PM, Ted Yu <yuzhihong@gmail.com> wrote:

> There're two copies of UtilWaitThread:
>
> ./core/src/main/java/org/apache/accumulo/core/util/UtilWaitThread.java
> ./fate/src/main/java/org/apache/accumulo/fate/util/UtilWaitThread.java
>
> I think interrupted status should be restored in the sleep() method.
>
> Cheers
>
>
> On Fri, Nov 1, 2013 at 7:45 PM, Josh Elser <josh.elser@gmail.com> wrote:
>
> > Awesome. Thanks for the article, Christopher, and the English
> > translation, Ted!
> >
> > On 11/1/13, 6:42 PM, Ted Yu wrote:
> > > Luckily Google comes to the rescue:
> > >
> > >
> >
> http://webcache.googleusercontent.com/search?q=cache:940mX01ckwMJ:www.ibm.com/developerworks/java/library/j-jtp05236/index.html%3Fiframe%3Dtrue%26width%3D80%25%26height%3D80%25+&cd=1&hl=en&ct=clnk&gl=us
> > >
> > >
> > > On Fri, Nov 1, 2013 at 3:39 PM, Ted Yu <yuzhihong@gmail.com> wrote:
> > >
> > >> In code reviews, I referred to the following article (I believe is the
> > >> same as the Chinese version) which isn't there anymore:
> > >> http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html
> > >>
> > >> The following search returned nothing:
> > >>
> > >>
> > >>
> >
> http://www.ibm.com/developerworks/java/library/?sort_by=&show_abstract=true&show_all=&search_flag=&contentarea_by=Java+technology&search_by=InterruptedException&topic_by=-1&industry_by=-1&type_by=All+Types&ibm-search=Search
> > >>
> > >> However, code speaks by itself. I often refer people to:
> > >> 清单 3. 捕捉 InterruptedException 后恢复中断状态
> > >> which says "restore interrupt status after
> catchingInterruptedException"
> > >>
> > >> Cheers
> > >>
> > >>
> > >> On Fri, Nov 1, 2013 at 3:31 PM, Christopher <ctubbsii@apache.org>
> > wrote:
> > >>
> > >>> It was pointed out to me by a colleague that we're not properly
> > >>> handling InterruptedException in many places.
> > >>>
> > >>> He cited this article (I could only find it in Chinese, but Google
> > >>> Translate works quite well converting it to English):
> > >>> http://www.ibm.com/developerworks/cn/java/j-jtp05236.html
> > >>>
> > >>> One place we do this a lot is UtilWaitThread. Should we be concerned
> > >>> about this? How do we want to address it?
> > >>>
> > >>> (Also, does anybody have a link to the English version of that
> > article?)
> > >>>
> > >>> --
> > >>> Christopher L Tubbs II
> > >>> http://gravatar.com/ctubbsii
> > >>>
> > >>
> > >>
> > >
> >
>



-- 
// - - -
// Bill Havanki
// Solutions Architect, Cloudera
// - - -

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message