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


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

Re: Proposed new Java feature

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Proposed new Java feature
Date 2012-05-28 12:13 +0200
Message-ID <a2h1djFoq2U2@mid.individual.net> (permalink)
References (4 earlier) <jpttrh$nqe$1@dont-email.me> <jptvdf$1s5$1@dont-email.me> <jpu11t$c79$1@dont-email.me> <jpu7m3$k7e$1@dont-email.me> <jpu9aj$t3p$1@dont-email.me>

Show all headers | View raw


On 05/28/2012 12:20 AM, markspace wrote:
> On 5/27/2012 2:51 PM, Eric Sosman wrote:
>> I understood it fine the first time around, thanks. If you
>> think of anything new to add, pray do so.
>
>
> This is uncharitable. In particular because I think his point went
> whooshing over your head, and you didn't understand it at all.
>
> He's saying the thread is done. Kaput. Any Sioux Unusual class using the
> thread will loose its thread locals, because at this point it expects
> the thread to die.

How can you know if you did not create the thread?  If the thread dies 
as in "terminates and then is GC'ed" there is no need for additional 
cleanup because GC will do that just fine.

> So instead of allowing the thread to die, we re-use it. But what would
> Sioux Unusual do? How would it expect this thread to be matched up with
> the same object ever again? There's no guarantee of that. Thread
> assignment from the executor is random. Worse, another Sioux Unusual
> object could see the thread local from some different object, and assume
> it's been assigned from its own invocation, when it clearly hasn't.
>
> Really, the problem is that Sioux Unusual is broken for this
> application, and shouldn't be used when threads are gong to be re-used
> and randomly reassigned. But that's not what he's talking about. He's
> talking about the case where he doesn't need the thread locals to
> persist, but he does need to use them, and to release them too.

But he cannot know how long ThreadLocals need to stay which are not 
created in his code.  If cleanup is needed then it must be done per 
ThreadLocal and never globally.

> The posts by myself and Tom should indicate that Mike is not alone in
> this need. He's got a real problem. That you insist that his
> requirements should be obviated because you or someone else might have
> some different requirement... well that just doesn't make sense.

If there is a real problem then it's not using ThreadLocal properly. 
That should be fixed.  And not a dangerous functionality added to 
standard library where changes are enormous to wreck havoc on all sorts 
of code.

Kind regards

	robert

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


Thread

Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-26 16:11 -0700
  Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-27 13:32 +0200
    Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-27 11:14 -0700
      Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-28 12:13 +0200
      Re: Proposed new Java feature v_borchert@despammed.com (Volker Borchert) - 2012-06-04 20:16 +0000
  Re: Proposed new Java feature markspace <-@.> - 2012-05-27 09:28 -0700
    Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-27 11:00 -0700
      Re: Proposed new Java feature Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-27 11:46 -0700
        Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-27 12:04 -0700
          Re: Proposed new Java feature Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-05-27 15:30 -0400
            Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-27 12:59 -0700
              Re: Proposed new Java feature Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-05-27 17:51 -0400
                Re: Proposed new Java feature markspace <-@.> - 2012-05-27 15:20 -0700
                Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-28 12:13 +0200
                Re: Proposed new Java feature markspace <-@.> - 2012-05-28 08:28 -0700
                Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-28 19:29 +0200
                Re: Proposed new Java feature markspace <-@.> - 2012-05-28 12:16 -0700
                Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-28 22:58 +0200
                Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-28 21:40 -0700
                Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-29 22:52 +0200
                Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-29 18:53 -0700
                Re: Proposed new Java feature Tom Anderson <twic@urchin.earth.li> - 2012-05-27 23:27 +0100
                Re: Proposed new Java feature Robert Klemme <shortcutter@googlemail.com> - 2012-05-28 12:22 +0200
                Re: Proposed new Java feature "Mike Schilling" <mscottschilling@hotmail.com> - 2012-05-27 21:43 -0700
                Re: Proposed new Java feature Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-05-29 14:32 +0000
  Re: Proposed new Java feature Tom Anderson <twic@urchin.earth.li> - 2012-05-27 18:43 +0100
  Re: Proposed new Java feature Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-06-02 12:41 -0700
    Re: Proposed new Java feature markspace <-@.> - 2012-06-02 15:55 -0700

csiph-web