cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@apache.org>
Subject Re: ReloadingClassloader events
Date Mon, 21 Feb 2005 20:56:54 GMT
> Sounds like an Observer pattern is needed so that whichever code needs
> the info can subscribe to "class XY was reloaded" events.

Exactly ...but one thing I am still thinking of:
How do I get hold of that instance of the classloader
so I can you can subscribe to the events?

One idea...

  class ReloadingHelper {
    public void static addListener(ReloadingListener object) {
      ClassLoader cl = object.getClass().getClassLoader();
      if (cl instanceof ReloadingClassLoader) {
        ((ReloadingClassLoader)cl).addListener(object);
      }
    }
  }

So after every object creation (that need to
be aware of reloading) you would need to do:

   MyObject a = new MyObject();
   ReloadingHelper.addListener(a);

As for having a classloader per sitemap ...I am not
quite sure if this is feasible. I mean: usually you
don't want to have a class repository (aka eclipse
project) per sitemap!

Let's say class org.apache.Bla is being changed
...how do we know what sitemap is using it? We
would also need to somehow use the observer pattern
for that. ...I am not sure if this really simplifies
things.

Although... maybe we need this for the kernel
anyway. (Pier?)

cheers
--
Torsten

Mime
View raw message