Re: RE: [Barracuda-commit] CVS Update: Barracuda
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Note that the following are exactly equivalent....
Class clazz = Thread.currentThread().getContextClassLoader().loadClass(clName);
Class clazz = Class.forName(clName, true,
Thread.currentThread().getContextClassLoader());
So, there is no change except for the syntax. We still load classes using
the thread context class loader in either case. At the time I wrote the
comment and made the switch from Class.forName() to the loadClass() method,
I wasn't aware of the more verbose Class.forName() method.
We should use Class.forName(clName, true,
Thread.currentThread().getContextClassLoader()) from now on.
Jake
At 10:14 AM 6/11/2003 -0600, you wrote:
>Hey Jake,
>
>I just saw your change to Classes (see commit message below)...this will
>effectively undo your change to ApplicationGateway. Consider the following:
>
>//jrk_20020414.1_start
> //Class.forName is java1. Since Java2, use
> //Thread.currentThread().getContextClassLoader().loadClass("MyClass")
> //This should fix some classloading issues in Engines with multiple
> //class loaders (eg.. Tomcat-3.3.x and Tomcat-4.x.x)
> //Class cl = Class.forName(eventName);
>//csc_060903_3 Class cl =
>Thread.currentThread().getContextClassLoader().loadClass(eventName);
> Class cl = Classes.getClass(eventName); //csc_060903_3
>//jrk_20020414.1_end
>
>In other words, you changed App gateway to use the longer method for getting
>a class, and then I changed your code to call Classes. SO...if you change
>Classes to use the .forName() approach, that effectively resets your change
>in app gateway.
>
>Just wanted to make sure you were aware of this. I'm ok with either method,
>but the reason why I was using the longer version in Classes was because of
>your previous change in app gateway...
>
>Christian
>----------------------------------------------
>Christian Cryder
>Internet Architect, ATMReports.com
>Project Chair, BarracudaMVC - http://barracudamvc.org
>----------------------------------------------
>"Coffee? I could quit anytime, just not today"
>
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]On Behalf Of
> > [email protected]
> > Sent: Wednesday, June 11, 2003 8:31 AM
> > To: [email protected]
> > Subject: [Barracuda-commit] CVS Update: Barracuda
> >
> >
> > CVSROOT: /var/cvs
> > Module name: Barracuda
> > Repository: Barracuda/src/org/enhydra/barracuda/plankton/
> > Changes by: [email protected].(none) 03/06/11 08:30:57
> >
> > Modified files:
> > Barracuda/src/org/enhydra/barracuda/plankton/: Classes.java
> >
> > Log message:
> > minor update to class loading using Class.forName(String,
> > boolean, ClassLoader). Just looks a bit cleaner and does the
> > same job as the previous code.
> >
> > Jake
> >
> > ===================================================================
> > File: no file Classes.java Status: Needs Checkout
> >
> > Working revision: 1.3 Wed Jun 11 14:30:56 2003
> > Repository revision: 1.3
> > /var/cvs/Barracuda/src/org/enhydra/barracuda/plankton/Classes.java,v
> >
> > Existing Tags:
> > Barracuda_1_2_0 (revision: 1.1)
> > jrk_20030217 (revision: 1.1)
> > jrk_20030203 (revision: 1.1)
> > csc_122702_2 (revision: 1.1)
> >
> > _______________________________________________
> > Barracuda-commit mailing list
> > [email protected]
> > http://barracudamvc.org/lists/listinfo/barracuda-commit
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda