commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [beanutils] per classloader BeanUtils
Date Thu, 27 Mar 2003 20:47:57 GMT


On Thu, 27 Mar 2003, robert burrell donkin wrote:

> Date: Thu, 27 Mar 2003 20:25:04 +0000
> From: robert burrell donkin <robertburrelldonkin@blueyonder.co.uk>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: [beanutils] per classloader BeanUtils
>
> hey craig
>
> IIRC we were talking before about using an instance per classloader
> (rather than singletons). i'm willing to have a stab at this but i thought
> that it'd be best if i run it past you first to make sure i understand
> correctly.
>
> the idea is that bean instances will be indexed by classloaders. when a
> static method is called, the context classloader of the current thread
> will be used to look up a bean instance. if no instance exists, then a new
> one will be created and added to the map with key the context classloader.
>   the process of getting instances will need to be synchronized.
>
> is this all correct?
>

Basically.  Here's a couple of things to keep in mind:

* The thread context class loader is guaranteed to be set for
  a web app (by the container), but won't necessarily be configured
  on a standalone application.  We'll need a fallback algorithm
  for when the context class loader is null -- my usual habit is
  to fall back to the class loader that loaded the BeanUtils class
  itself.

* In servlet containers that support dynamic reloading, the container
  implements this by throwing away the old webapp class loader and
  creating a new one.  To avoid memory leaks, we'll want to ensure
  that there is a public method that a webapp can call (as part of its
  shutdown processing) to release anything in any map that is keyed
  by the class loader involved.

* We might want to look at how the commons-discovery package does
  things -- I think it's got a discovery mode that works this way
  already which we could copy (or perhaps even use directly if we're
  willing to add a new dependency).

> - robert
>

Craig

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