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



Reply via email to