On Thu, 16 May 2002 18:19, Leo Simons wrote: > > > Phoenix does a lot with classloaders (should do more, > > > really). One benefit would be we can finally create some > > > common components for access by all applications (or even > > > arbitrarily marked applications). > > > > So how does it handle Classloader scope? > > I must say I dunno: Pete's probably changed it from 7 months back ;)
Nope - not yet. Need to but haven't been sufficiently motivated yet ;) > > And how does it ensure one instance per classloader? > > It doesn't, currently. I'm not sure what would be the best way to do so; > I don't think it is impossible. It is possible to get the ClassLoader of calling class via a few ugly hacks in pre-jdk1.4 (mainly creating security manager and performing magic) but I am not sure it is worth the effort. I have done this before and it was not simple for the users to understand how this works. > Components that also deal with loading/registry of classes / instances. > If you have a Component that offers a JNDI service, it'd better be > unique to your system. That's the point of having it, I think. For things that are JVM static the best option is often to create a delegating instance of resource. What do I mean? Take a URLStreamFactory, InitialContextFactory or whatever. They are generally static across whole JVM. However you can create a single Fatcory that contains references to other factories (that are associated with a thread) and then use a ThreadLocal to make sure you get right factory for correct thread. It is the same way that you can redirect system out from a particular thread to a particular logger or whatever. -- Cheers, Peter Donald -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>