cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <alexander.klimetsc...@mindquarry.com>
Subject Re: Shielded class loading between blocks
Date Tue, 21 Nov 2006 15:51:32 GMT
Daniel Fagerstrom schrieb:
> Alexander Klimetschek skrev:
>> Another requirement what just popped up is to allow "groups" of 
>> servlets that use the same classloader. This is useful if you have 
>> some Servlets and jsps that ought to be used together, because the 
>> multiple Servlets and JSPs access some singleton / static Java class. 
>> Here it is necessary that all servlets and stuff are loaded by the 
>> same classloader.
> 
> Is this really a problem that we need to solve? In most cases using the 
> common servlet container context classloader or a block servlet local 
> classloader should be enough. I would need some concrete use cases to 
> become convinced that it is worth the extra complexity.

Yes, it is. The Solr project for example consists of two Java Servlets, 
one for storing documents and one for querying documents. Then there is 
a bunch of jsps to administrate the Solr installation. Both Servlets and 
jsps make use of static methods of a "SolrCore" class, so they all need 
the same classloader. The jsps are handled via a sitemap (BTW, I have 
patched cocoon-jsp to work with BlockServlets, its not yet perfect, so I 
haven't posted a patch yet).

The need for shielding comes through the dependency for a nightly-built 
Lucene, which conflicts with another part of our webapp, where an old 
Lucene is used.

IMHO this might happen any time again and having the flexibility of 
classloading in Java is perfect for solving those problems. I have 
implemented that shielded groups stuff in the old 
BootstrapClassLoaderManager, right now, I am writing on a 
ShieldingBlockServlet as a proof of concept and to be up-to-date with 
the cocoon trunk.

> IMO it would be useful to have a classloader at the block level and have 
> some mechanism for importing and exporting packages and services between 
> the blocks. Fortunately clever people already have put together a 
> standardized solution for this ;) http://www.springframework.org/osgi.

How much time will it approximately take to have a stable OSGI 
implementation in cocoon?

Alex

-- 
Alexander Klimetschek
http://www.mindquarry.com


Mime
View raw message