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


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

Re: Proposed new Java feature

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Proposed new Java feature
Date Mon, 28 May 2012 08:28:17 -0700
Organization A noiseless patient Spider
Lines 38
Message-ID <jq05ij$kt9$1@dont-email.me> (permalink)
References <jprnu7$uv8$1@dont-email.me> <jptkmp$vbg$1@dont-email.me> <jptq42$1jo$1@dont-email.me> <8Euwr.47425$On2.20024@newsfe16.iad> <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> <a2h1djFoq2U2@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 28 May 2012 15:28:19 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="2kn9RzOWSe/v/hLnHgGT4Q"; logging-data="21417"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+M/xBUQK5IaiFlGCPsVsB7exjrktMvXZc="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1
In-Reply-To <a2h1djFoq2U2@mid.individual.net>
Cancel-Lock sha1:Yl1msgBwYhh/OogUWAr5nq6FXYc=
Xref csiph.com comp.lang.java.programmer:14862

Show key headers only | View raw


On 5/28/2012 3:13 AM, Robert Klemme wrote:
> How can you know if you did not create the thread?


But we are creating the thread.  It's part of a thread pool for general 
use.  That's his use case; it's the fundamental crux of his request.


> 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.


Threads in a thread pool don't die, they are re-used.  Hence the need 
for manual (even external) clean-up.


> But he cannot know how long ThreadLocals need to stay which are not
> created in his code.


When the thread is returned to the pool, all thread locals must be 
marked as invalid.  Period.


> 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.


I can think of a few scenarios where it would be useful to use both 
thread locals and a thread pool, so while maybe "dangerous" it's still 
something we should investigate properly.  Hacks like the reflective 
code I linked to earlier that dump private fields seem a lot more 
"dangerous" to me, yet they are currently needed.

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