Howdy,
Just be very careful with ThreadLocal -- it's inherently evil and easy
to misuse.

Consider the PooledExecutor from Doug Lea's util-concurrent package
(which will become java.util.concurrent in J2SE 1.5, Doug Lea's the spec
lead for JSR 166) as an alternative:
http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/int
ro.html

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Kenneth H. Cox [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 30, 2003 1:00 PM
>To: Tomcat Users List
>Subject: Re: How do I listen for threads starting and stopping?
>
>Sorry; I was unclear.  I'm planning to use TclBlend to start one
>Tcl interpreter per thread (a Tcl interp cannot jump threads and
>so cannot be pooled).  Starting and initializing these interps is
>somewhat heavyweight, so my plan was to keep them around until
>Tomcat discards the thread or the thread dies of natural causes,
>at which point I would like to be notified, so I can free my interp
>(and the memory allocated by its native code).
>
>Unless (duh?) a ThreadLocal variable will do this for me.  Yes,
>it seems that it will.  Thanks for kicking my brain back into gear.
>
>p.s. Any other Tomcat / TclBlend users out there?  I'm hunting
>for a combination of JDK/TclBlend/Tcl/Thread that play together.
>
>Ken
>
>
>On Wed, 28 May 2003 22:00:56 -0700, Bill Barker <[EMAIL PROTECTED]>
>wrote:
>
>> The simplest (portable) way to do this is to pretend that Threads are
the
>> same as Requests, and use request.setAttribute("foo",bar).  These
will
>> automatically be discarded (i.e. eligible for GC) at the end of the
>> Request.
>> If you need to do explicit cleanup, then you have to wait for TC 5.x,
>> which
>> has RequestListeners to tell you when the Request starts and ends.
>>
>> "Kenneth H. Cox" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>> I have some per-thread data that I need to dispose of
>>> when Tomcat connector thread goes away.  I'm using the
>>> Coyote Connector.  Is there a way to do it?  A Tomcat-specific
>>> mechanism is just fine for now, thank you.
>>>
>>> I found HttpConnector.addLifecycleListener(), but all the
>>> methods are marked deprecated and I'm not sure how to get at the
>>> HttpConnector in the first place.
>>>
>>> Any pointers in the right direction would be greatly appreciated.
>>>
>>> Regards,
>>> kenstir
>>>
>>> --
>>> Using M2, Opera's revolutionary e-mail client:
http://www.opera.com/m2/
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
>--
>Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to