Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14831
| 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 | Sun, 27 May 2012 09:28:08 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 31 |
| Message-ID | <jptkmp$vbg$1@dont-email.me> (permalink) |
| References | <jprnu7$uv8$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 27 May 2012 16:28:10 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="2kn9RzOWSe/v/hLnHgGT4Q"; logging-data="32112"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gtX8RK41JhuxZU9XNLjpUxsSFREzLo58=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
| In-Reply-To | <jprnu7$uv8$1@dont-email.me> |
| Cancel-Lock | sha1:+Znsr0xCcfpYDFOTqOmPsgmy0FA= |
| Xref | csiph.com comp.lang.java.programmer:14831 |
Show key headers only | View raw
On 5/26/2012 4:11 PM, Mike Schilling wrote: > Proposed feature: a static method on Thread that clears all ThreadLocals for > the current thread. > I can see your points. However, I don't have any real experience with ThreadLocal, and when a neophyte agrees with your argument, that's a red flag. Here's a blog where someone seems to have the same issue as you. <http://weblogs.java.net/blog/jjviana/archive/2010/06/10/threadlocal-thread-pool-bad-idea-or-dealing-apparent-glassfish-memor> At the end of the comments, there's a suggestion to use ThreadLocal::remove(), with the implication that it allows the thread local variable to be garbage collection. Is there a reason that doesn't work for you? My other thought is that "for the current thread" could be improved with "for a given thread." So, inside an Executor, I can just call Thread t = ... // .. use the thread .. Thread.removeLocals( t ); // now add the thread back into the pool... And this seems better because I don't have to rely on the users of a thread remembering to do it themselves. External control seems better here.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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