|
From: Juergen H. <ju...@in...> - 2005-06-15 20:26:40
|
Quoting myself from my reply to Billy's post: Actually, Spring does not use ThreadLocals in the way you describe. Spring always just uses ThreadLocals temporarily, while guaranteed to be on the same thread, with proper cleanup at the end (in any case). This applies to transaction ThreadLocals as well as to others. IMO, this is completely valid: As long as the ThreadLocal is always guaranteed to be cleaned up when returning the thread to the server's pool, I cannot see anything going wrong... So it's not about using ThreadLocals in general, it's about _properly_ using ThreadLocals. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of John Watson Sent: Wednesday, June 15, 2005 10:24 PM To: spr...@li... Subject: Re: [Springframework-developer] Article on not using ThreadLocal The real question (IMHO) is why thread-pool vendors don't clear thread locals! I do agree that it can be very dangerous to use the ThreadLocal. You do need to know what you're doing when you use them. I wish that vendors would help protect us from our own sloppiness, though. John On 6/15/05, Tim Kettering <tim...@vi...> wrote: > > > > This guy (presumably a senior dev @ IBM) says not to use ThreadLocal. He > says that usage should be removed from open-source projects (mentioning > Spring specifically). > > > > Wanted to pass this url on – see what you Spring developers thought about > this… > > > > http://www.devwebsphere.com/devwebsphere/2005/06/dont_use_thread.html HSµéŠX²š²Šu¼ŠÇ½êjÌŠ{2(jØ+j׉뮉ÁÛš™¶‡–ZF†™ª²ÚŠ~Šj·®Ø•ëú™«½åmƶÆvjxgz÷ÊØ žºwvÚzÛ¶‹yçj˶Úý§¢Çr‰iØ¾í©¡È^÷jÉrD®)~¶{ ‘×zZz¹ŠX‚Xµ*Šx©ÂŠuë–Š®X¶Ëº·~Šzw†Û³ÿŠË²‹qç®zߊËþX¶)£û®)~¶{ ‘×zZ |