sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konrad Windszus <konra...@gmx.de>
Subject Re: Dynamic Class Loader Manager causes lots of service restarts
Date Tue, 22 Oct 2019 08:21:25 GMT
Hi Julian,
thanks a lot for bringing up this topic. Indeed the restart cascade causes some issues for
me as well. Just invalidating the cache of the DCLM without restarting it fully sounds reasonable
to me, but I am not that familiar with class loader insights. I vaguely remember that the
restart might be necessary due to static cache fields but I don't remember the details...
Maybe Carsten remembers...
Konrad

> On 22. Oct 2019, at 10:00, Julian Sedding <jsedding@gmail.com> wrote:
> 
> Hi all
> 
> I have observed repeatedly that reinstalling bundles of a custom Sling
> (actually AEM) application causes a lot of activity in the OSGi
> framework and thus can take quite a long time (10s of seconds to
> minutes), which feels quite disruptive during development where
> frequent deployments are common.
> 
> As far as I can see the Dynamic Class Loader Manager (DCLM) does "the
> right thing" and restarts itself when a bundle whose classes have been
> loaded via the dynamic class loader is reinstalled. The restart of the
> DCLM then causes all services referencing it to restart as well,
> causing, amongst others, scripting engines to restart and generally
> triggering a cascade of service restarts.
> 
> This seems to be especially common with bundles providing model
> classes that are used in rendering scripts (a prime use-case for
> customizations), but is not limited to such cases. Note: it is
> necessary to run a rendering script using the model before
> reinstalling the bundle in order to cause the restarts
> 
> I was wondering if it wouldn't be possible to change the DCLM in a way
> that it doesn't need to restart, but that it just swaps out the class
> loader(s) behind the facade.I don't have much experience with
> implementing custom class loaders, but I have a hunch that this may be
> difficult to get right due to class loader internal caching of loaded
> classes.
> 
> Is there anyone more knowledgable in this area who could provide an
> assessment regarding the feasibility of such an approach?
> 
> Regards
> Julian


Mime
View raw message