Hi,

Instead of invoking CatalogFactory.getInstance everytime, thought we can invoke 
the getInstance as soon as we parse and keep the instance as static in the 
parser/init class. But it defeats the purpose of ClassLoader usage in the 
getInstance. 


Hope there won't be any issues with such usage.


Regards,
Jagan

---- On Sat, 12 Oct 2013 14:48:37 +0530 Benedikt Ritter 
<[email protected]> wrote ---- 


Hi Jagan, 
 
sorry I don't understand what you mean by "retained CatalogFactory instance 
in our backend code". Can you explain? 
 
Benedikt 
 
 
2013/10/12 Jagan Ranganathan <[email protected]> 
 
> Hi, 
> 
> 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? 
> 
> 
> Regards, 
> Jagan 
> 
> ---- On Fri, 11 Oct 2013 14:52:25 +0530 Benedikt 
> Ritter<[email protected]> 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... 
> 
> Benedikt 
> 
> [1] http://modello.codehaus.org 
> 
> 
> 2013/10/11 Jagan Ranganathan <[email protected]> 
> 
> > Hi, 
> > 
> > We are trying to use Chain Of Responsibility pattern in the 
server 
> side. 
> > We have defined our chain+commands in an xml and are parsing it 
via 
> > ConfigParser. 
> > 
> > 
> > But we face a problem with getting Catalog via 
> > CatalogFactoryBase.getInstance().getCatalog(catalogName) 
call.Looks 
> like it 
> > has got some ClassLoader specific loading. So if we have 
initialized 
> in 
> > some web context, the Catalog is not present in other context - 
> different 
> > ClassLoader. 
> > Is there anyway we can remove this ClassLoader level dependency 
or is 
> > there any other way of loading the chain configuration for server 
side 
> > usage? 
> > /** * <p>Return the singleton {@link 
CatalogFactory} 
> instance 
> > * for the relevant 
> <code>ClassLoader</code>. For 
> > applications 
> > * that use a thread context class loader (such as web 
applications 
> > * running inside a servet container), this will return a separate 
> > * instance for each application, even if this class is loaded 
from 
> > * a shared parent class loader.</p> 
> > * 
> > * @return the per-application singleton instance of {@link 
> > CatalogFactory} 
> > */ 
> > public static CatalogFactory getInstance() { 
> > 
> > 
> > CatalogFactory factory = null; 
> > ClassLoader cl = getClassLoader(); 
> > synchronized (factories) { 
> > factory = (CatalogFactory) factories.get(cl); 
> > if (factory == null) { 
> > factory = new CatalogFactoryBase(); 
> > factories.put(cl, factory); 
> > } 
> > } 
> > return factory; 
> > 
> > 
> > } 
> > 
> > Regards, 
> > Jagan 
> > 
> > 
> > 
> > 
> 
> 
> -- 
> http://people.apache.org/~britter/ 
> http://www.systemoutprintln.de/ 
> http://twitter.com/BenediktRitter 
> http://github.com/britter 
> 
> 
> 
> 
 
 
-- 
http://people.apache.org/~britter/ 
http://www.systemoutprintln.de/ 
http://twitter.com/BenediktRitter 
http://github.com/britter 



Reply via email to