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&lt;[email protected]&gt; 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 &lt;[email protected]&gt; > > &gt; Hi, > &gt; > &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; > &gt; > &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;. For > &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; > &gt; > &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; > &gt; } > &gt; > &gt; Regards, > &gt; Jagan > &gt; > &gt; > &gt; > &gt; > > > -- > 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
