From a341992b05cd376a9522d61fcd6983f6bc8dbb24 Mon Sep 17 00:00:00 2001
From: Simon Kitching
org.apache.commons.logging.LogFactory looks to see whether this
- * class is present in the classpath, and if so then uses it to store
+ *
org.apache.commons.logging.LogFactory checks whether this class
+ * can be supported by the current JVM, and if so then uses it to store
* references to the LogFactory implementationd it loads
* (rather than using a standard Hashtable instance).
* Having this class used instead of Hashtable solves
* certain issues related to dynamic reloading of applications in J2EE-style
* environments. However this class requires java 1.3 or later (due to its use
- * of java.lang.ref.WeakReference and associates) and therefore cannot be
- * included in the main logging distribution which supports JVMs prior to 1.3.
+ * of java.lang.ref.WeakReference and associates).
* And by the way, this extends Hashtable rather than HashMap
* for backwards compatibility reasons. See the documentation
* for method LogFactory.createFactoryStore for more details.
LogFactory's
- * factories member! If LogFactory.release() is called whenever component
- * is unloaded (as happens in some famous containers), the classloaders will be correctly
- * garbage collected.
- * However, holding the classloader references weakly ensures that the classloader
- * will be garbage collected without programmatic intervention.
- * Unfortunately, weak references are
- * only available in java 1.3+, so this code only uses WeakHashtable if the
- * class has explicitly been made available on the classpath.
- *
- * - * Because the presence of this class in the classpath ensures proper - * unload of components without the need to call method - * {@link org.apache.commons.logging.LogFactory#release(ClassLoader) LogFactory.release ClassLoader)}, - * it is recommended that this class be deployed along with the standard - * commons-logging.jar file when using commons-logging in J2EE - * environments (which will presumably be running on Java 1.3 or later). - * There are no know ill effects from using this class.
+ * reference to the component's classloader from a key in the "global" + *LogFactory's factories member! If LogFactory.release()
+ * is called whenever component is unloaded, the classloaders will be correctly
+ * garbage collected; this should be done by any container that
+ * bundles commons-logging by default. However, holding the classloader
+ * references weakly ensures that the classloader will be garbage collected
+ * without the container performing this step.
*
* * Limitations: * There is still one (unusual) scenario in which a component will not * be correctly unloaded without an explicit release. Though weak references - * are used for its keys, it is necessary to use - * strong references for its values.
+ * are used for its keys, it is necessary to use strong references for its values. + * * * If the abstract class LogFactory is
* loaded by the container classloader but a subclass of