public static void releaseFactories() throws FacesException { ClassLoader classLoader = getClassLoader(); _factories.remove(classLoader); }
private static void _releaseFactories() throws FacesException { ClassLoader classLoader = getClassLoader(); // This code must be synchronized synchronized (_registeredFactoryNames) { _factories.remove(classLoader); // _registeredFactoryNames has as value type Map<String,List> and this must // be cleaned before release (for gc). Map<String, List<String>> factoryClassNames = _registeredFactoryNames.get(classLoader); if (factoryClassNames != null) { factoryClassNames.clear(); } _registeredFactoryNames.remove(classLoader); } }
/** * <p>Release any references to factory instances associated with the * class loader for the calling web application. This method should be * called as apart of web application shutdown in a container where the * JavaServer Faces API classes are part of the container itself, rather * than being included inside the web application.</p> * * @throws FacesException if the web application class loader * cannot be identified */ public static void releaseFactories() throws FacesException { // Identify the web application class loader ClassLoader cl = getClassLoader(); FACTORIES_CACHE.removeApplicationFactoryManager(cl); }
/** * <p><span class="changed_modified_2_0">Release</span> any * references to factory instances associated with the class loader * for the calling web application. <span * class="changed_modified_2_0">This method must be called during of * web application shutdown.</span></p> * * @throws FacesException if the web application class loader * cannot be identified */ public static void releaseFactories() throws FacesException { // Identify the web application class loader ClassLoader cl = getClassLoader(); FACTORIES_CACHE.removeApplicationFactoryManager(cl); }
public static void setFactory(String factoryName, String implName) { checkFactoryName(factoryName); ClassLoader classLoader = getClassLoader(); synchronized(_registeredFactoryNames) { Map factories = _factories.get(classLoader); if (factories != null && factories.containsKey(factoryName)) { // Javadoc says ... This method has no effect if getFactory() has already been // called looking for a factory for this factoryName. return; } Map<String, List> factoryClassNames = _registeredFactoryNames.get(classLoader); if (factoryClassNames == null) { factoryClassNames = new HashMap<String, List>(); _registeredFactoryNames.put(classLoader, factoryClassNames); } List<String> classNameList = factoryClassNames.get(factoryName); if (classNameList == null) { classNameList = new ArrayList<String>(); factoryClassNames.put(factoryName, classNameList); } classNameList.add(implName); } }
ClassLoader classLoader = getClassLoader(); Map<String, List<String>> factoryClassNames = null; synchronized (registeredFactoryNames)
ClassLoader classLoader = getClassLoader(); Map<String, List<String>> factoryClassNames = null; synchronized (_registeredFactoryNames)
private static void _releaseFactories() throws FacesException ClassLoader classLoader = getClassLoader();
throw new NullPointerException("factoryName may not be null"); ClassLoader classLoader = getClassLoader(); Map factoryClassNames = _registeredFactoryNames.get(classLoader);
ClassLoader classLoader = getClassLoader();
private static Object _getFactory(String factoryName) throws FacesException ClassLoader classLoader = getClassLoader();
/** * <p>This method will store the argument * <code>factoryName/implName</code> mapping in such a way that * {@link #getFactory} will find this mapping when searching for a * match.</p> * <p/> * <p>This method has no effect if <code>getFactory()</code> has * already been called looking for a factory for this * <code>factoryName</code>.</p> * <p/> * <p>This method can be used by implementations to store a factory * mapping while parsing the Faces configuration file</p> * * @throws IllegalArgumentException if <code>factoryName</code> does not * identify a standard JavaServer Faces factory name * @throws NullPointerException if <code>factoryname</code> * is null */ public static void setFactory(String factoryName, String implName) { validateFactoryName(factoryName); // Identify the web application class loader ClassLoader classLoader = getClassLoader(); FactoryManager manager = FACTORIES_CACHE.getApplicationFactoryManager(classLoader); manager.addFactory(factoryName, implName); }
/** * <p>This method will store the argument * <code>factoryName/implName</code> mapping in such a way that * {@link #getFactory} will find this mapping when searching for a * match.</p> * <p/> * <p>This method has no effect if <code>getFactory()</code> has * already been called looking for a factory for this * <code>factoryName</code>.</p> * <p/> * <p>This method can be used by implementations to store a factory * mapping while parsing the Faces configuration file</p> * * @throws IllegalArgumentException if <code>factoryName</code> does not * identify a standard JavaServer Faces factory name * @throws NullPointerException if <code>factoryname</code> * is null */ public static void setFactory(String factoryName, String implName) { validateFactoryName(factoryName); // Identify the web application class loader ClassLoader classLoader = getClassLoader(); FactoryManager manager = FACTORIES_CACHE.getApplicationFactoryManager(classLoader); manager.addFactory(factoryName, implName); }
/** * <p>Create (if necessary) and return a per-web-application instance of * the appropriate implementation class for the specified JavaServer Faces * factory class, based on the discovery algorithm described in the * class description.</p> * * @param factoryName Fully qualified name of the JavaServer Faces factory * for which an implementation instance is requested * @throws FacesException if the web application class loader * cannot be identified * @throws FacesException if an instance of the configured factory * implementation class cannot be loaded * @throws FacesException if an instance of the configured factory * implementation class cannot be instantiated * @throws IllegalArgumentException if <code>factoryName</code> does not * identify a standard JavaServer Faces factory name * @throws IllegalStateException if there is no configured factory * implementation class for the specified factory name * @throws NullPointerException if <code>factoryname</code> * is null */ public static Object getFactory(String factoryName) throws FacesException { validateFactoryName(factoryName); // Identify the web application class loader ClassLoader classLoader = getClassLoader(); FactoryManager manager = FACTORIES_CACHE.getApplicationFactoryManager(classLoader); return manager.getFactory(classLoader, factoryName); }
ClassLoader classLoader = getClassLoader();