cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: ReloadingClassloader events
Date Tue, 22 Feb 2005 16:30:07 GMT
Torsten Curdt wrote:
>> 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);

Looks too complicated, and probably will be way too slow or way too memory 
hungry in the end.

I'm with Stefano: keep it simple, reload everything. If sitemap has own class 
repository you don't have to think twice what to reload on class change: whole 
sitemap whose class is updated and all its subsitemaps.

Vadim

Mime
View raw message