Re: WebObjects classloader fun.
Re: WebObjects classloader fun.
- Subject: Re: WebObjects classloader fun.
- From: Mike Schrag <email@hidden>
- Date: Fri, 30 Mar 2007 00:44:08 -0400
Does anyone know much about how webobjects uses the classloader and
how the _NSUtilities class cache is initialized and used?
[snip] it appears that _NSUtilities has a static initialiser that
pulls in and caches classes rather than asking the current thread
context classloader for them when needed [snip]
You are correct ... Frameworks (and your app) are loaded by NSBundle,
which traverses all of the classpath and loads the reachable classes
into the NSUtilities cache (so you can do things like looking up a
component by name -- _NSUtilities.classWithName(..)). You can also
override these class names by calling _NSUtilities.setClassForName.
If the name was not in the cache, it will Class.forName it and then
put the result into the cache. This behavior makes packageless
WOComponent name lookups (for instance) very fast in exchange for
some kind of weird behavior (like cross-your-fingers-if-you-have-two-
classes-with-the-same-name).
Unfortunately, I don't know of any way to REMOVE an entry from the
cache. You can't setClassForName(null, "ClassName") because that
tries to put a null key into the cache. If you specifically know the
class name, you can replace it yourself -- ERXPatcher is generally
just calling setClassForName with classes it replaces.
ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden