commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jagan Ranganathan <>
Subject Re: Chain Configuration
Date Sat, 12 Oct 2013 00:49:10 GMT

Thanks for your response. We retained CatalogFactory instance in our backend code where we
parsed the chain config xml. You see any issues with this?


---- On Fri, 11 Oct 2013 14:52:25 +0530 Benedikt Ritter&lt;;
wrote ---- 

Hi Jagan, 
as far as I know, no there isn't... We know this is a flaw in chain and we 
intended to fix it for chain2 (which is in the current trunk of chain). But 
currently there is nobody who really has the time make chain2 ready for a 
release. Simone Tripodi was working on it and he intended to implement the 
configuration module using modello [1]. But that seems to be blocked until 
a new modello release hits the road... 
2013/10/11 Jagan Ranganathan &lt;; 
&gt; Hi, 
&gt; We are trying to use Chain Of Responsibility pattern in the server side. 
&gt; We have defined our chain+commands in an xml and are parsing it via 
&gt; ConfigParser. 
&gt; But we face a problem with getting Catalog via 
&gt; CatalogFactoryBase.getInstance().getCatalog(catalogName) call.Looks like it 
&gt; has got some ClassLoader specific loading. So if we have initialized in 
&gt; some web context, the Catalog is not present in other context - different 
&gt; ClassLoader. 
&gt; Is there anyway we can remove this ClassLoader level dependency or is 
&gt; there any other way of loading the chain configuration for server side 
&gt; usage? 
&gt; /** * &amp;lt;p&amp;gt;Return the singleton {@link CatalogFactory} instance

&gt; * for the relevant &amp;lt;code&amp;gt;ClassLoader&amp;lt;/code&amp;gt;.
&gt; applications 
&gt; * that use a thread context class loader (such as web applications 
&gt; * running inside a servet container), this will return a separate 
&gt; * instance for each application, even if this class is loaded from 
&gt; * a shared parent class loader.&amp;lt;/p&amp;gt; 
&gt; * 
&gt; * @return the per-application singleton instance of {@link 
&gt; CatalogFactory} 
&gt; */ 
&gt; public static CatalogFactory getInstance() { 
&gt; CatalogFactory factory = null; 
&gt; ClassLoader cl = getClassLoader(); 
&gt; synchronized (factories) { 
&gt; factory = (CatalogFactory) factories.get(cl); 
&gt; if (factory == null) { 
&gt; factory = new CatalogFactoryBase(); 
&gt; factories.put(cl, factory); 
&gt; } 
&gt; } 
&gt; return factory; 
&gt; } 
&gt; Regards, 
&gt; Jagan 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message