From 9f33f5482d1602e77eb861f08f96f765aac91da9 Mon Sep 17 00:00:00 2001 From: "Craig R. McClanahan" Date: Wed, 18 Dec 2002 07:20:50 +0000 Subject: [PATCH] Experimentally add a release(ClassLoader) method that lets, for example, a webapp clean up references to any LogFactory, and associated Log instances, that are associated with its class loader. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138948 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/logging/LogFactory.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/commons/logging/LogFactory.java b/src/java/org/apache/commons/logging/LogFactory.java index 7800a7f..30d2767 100644 --- a/src/java/org/apache/commons/logging/LogFactory.java +++ b/src/java/org/apache/commons/logging/LogFactory.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogFactory.java,v 1.18 2002/12/13 16:55:39 rsitze Exp $ - * $Revision: 1.18 $ - * $Date: 2002/12/13 16:55:39 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/LogFactory.java,v 1.19 2002/12/18 07:20:50 craigmcc Exp $ + * $Revision: 1.19 $ + * $Date: 2002/12/18 07:20:50 $ * * ==================================================================== * @@ -87,7 +87,7 @@ import java.util.Properties; * @author Craig R. McClanahan * @author Costin Manolache * @author Richard A. Sitze - * @version $Revision: 1.18 $ $Date: 2002/12/13 16:55:39 $ + * @version $Revision: 1.19 $ $Date: 2002/12/18 07:20:50 $ */ public abstract class LogFactory { @@ -416,6 +416,27 @@ public abstract class LogFactory { } + /** + * Release any internal references to previously created {@link LogFactory} + * instances that have been associated with the specified class loader + * (if any), after calling the instance method release() on + * each of them. + * + * @param classLoader ClassLoader for which to release the LogFactory + */ + public static void release(ClassLoader classLoader) { + + synchronized (factories) { + LogFactory factory = (LogFactory) factories.get(classLoader); + if (factory != null) { + factory.release(); + factories.remove(classLoader); + } + } + + } + + /** * Release any internal references to previously created {@link LogFactory} * instances, after calling the instance method release() on