Kenji Konaka wrote:

> >      2) Is it possible to load a load a normal java class into the same 
>classloader more than
> >      once?
> >
> >      No, not possible.
>
> that's true;
> but slight variation of this problem is:
>
> * - it is still possible to write a classloader which loads (or
> generates on the fly) [only] a proxy of the target class originally
> requested, so that later [when needed], this proxy class can
> trash(along with its backend,hidden classloader) the initially loaded
> original target class, to load another one (or even while the first
> one is still in effect), so that new client requests can then be start
> diverted to this new (backend-target) class, from then on...
>
> for a sample program of this; maybe try
> http://bcel.sourceforge.net/ - Examples - ProxyCreator.java

Sure, a custom class loader can employ various class loading techniques.  I've used 
BCEL quite
extensively, and although it's a very powerful byte code manipulator, I'm not sure 
it's necessary
for the problem you describe.  The ProxyCreator, for example, requires the use of the 
JavaWrapper
to gain visibility into loaded classes.  Using a custom class loader, it's also 
possible to gain
this visibility for those classes that the custom class loader is responsible for 
loading.  If,
however, it's desirable to proxy all classes, including system-level classes, then the 
ProxyCreator
approach is necessary.

Mike

--
Mike Clark
Clarkware Consulting, Inc.
http://www.clarkware.com
720.851.2014

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to