commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [logging] demonstration code
Date Wed, 23 Mar 2005 22:21:07 GMT
On Tue, 2005-03-22 at 22:36 -0800, Brian Stansberry wrote:

<snip>

> This is a bit of a nit, but one thing I noticed was
> the emphasis on "creator" and "created" in the
> discussion of the thread context class loader. 
> Setting of the TCCL is not necessarily closely
> associated with thread creation but can also be
> associated with thread execution crossing a
> significant application boundary.  For example in
> Tomcat a pool of threads is created (I believe by the
> connector code).  Not sure if any TCCL is set at that
> point, but if one is it's for sure not any web app's
> classloader.  Once a thread has been assigned to
> handle a request, execution moves through the various
> TC container layers (Engine, Host) and only when
> execution is about to enter the Context layer is the
> TCCL set to the web app's classloader.  When the call
> to the Context layer returns the TCCL is set back to
> what it was before.  A similar approach is followed in
> JBoss.
> 
> Interestingly, the Javadoc for
> Thread.setContextClassLoader() itself emphasizes the
> relationship between thread creation and setting the
> TCCL, but this is somewhat misleading.

good point

the link between the concept of application boundaries, threads and
containers is missing and should really be spelt out. 

from a narrative perspective, it's probably important to give the
specification and then explain that creator (in the sense of the thread
context classloader documentation) in the case of a container (or any
other thread pooled application) encompasses the concept of owner. so,
the owner of the thread should ensure that a thread has an appropriate
classloader set for the application currently executing in that thread.
this can then link into the (missing) subject of application boundaries.

in addition, it's probably worth including something of craig's
explanation about the evolution of class-first classloading in the J2EE
section. JCL needs to run on older containers and so people need to be
aware of this. 

i takes me a lot of energy to write documentation and the context
hierarchical section didn't get as much as the preceding section. it
could probably do with revisiting but i'm not sure when i'll find the
time. so, i'd be grateful for patches.  

i think that the consensus is that ensuring that applications release
logging (and other resources) correctly is something that applications
should definitely be taking seriously. it's worth explaining this in the
user guide. again, i'd be grateful for patches. 

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message