From cb9cc0af15bb339d6751e023839a511a7609633c Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 24 Mar 2010 16:13:29 +0000 Subject: [PATCH] Tracking down a memory leak. Add some debug logging to the mapper. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@927105 13f79535-47bb-0310-9956-ffa450edef68 --- .../tomcat/util/http/mapper/LocalStrings.properties | 16 ++++++++++++++++ java/org/apache/tomcat/util/http/mapper/Mapper.java | 17 ++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 java/org/apache/tomcat/util/http/mapper/LocalStrings.properties diff --git a/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties b/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties new file mode 100644 index 000000000..953aaeb0f --- /dev/null +++ b/java/org/apache/tomcat/util/http/mapper/LocalStrings.properties @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +mapper.removeWrapper=Removing wrapper from Context [{0}] with path [{1}] \ No newline at end of file diff --git a/java/org/apache/tomcat/util/http/mapper/Mapper.java b/java/org/apache/tomcat/util/http/mapper/Mapper.java index 773fcc4e0..f552df0b8 100644 --- a/java/org/apache/tomcat/util/http/mapper/Mapper.java +++ b/java/org/apache/tomcat/util/http/mapper/Mapper.java @@ -23,6 +23,8 @@ import javax.naming.directory.DirContext; import org.apache.tomcat.util.buf.CharChunk; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.buf.Ascii; +import org.apache.tomcat.util.res.StringManager; + import java.util.List; import java.util.ArrayList; @@ -35,8 +37,12 @@ import java.util.ArrayList; public final class Mapper { - private static final org.apache.juli.logging.Log logger = + private static final org.apache.juli.logging.Log log = org.apache.juli.logging.LogFactory.getLog(Mapper.class); + + protected static final StringManager sm = + StringManager.getManager(Mapper.class.getPackage().getName()); + // ----------------------------------------------------- Instance Variables @@ -221,7 +227,7 @@ public final class Mapper { pos = find(hosts, hostName); } if (pos < 0) { - logger.error("No host found: " + hostName); + log.error("No host found: " + hostName); } Host host = hosts[pos]; if (host.name.equals(hostName)) { @@ -328,7 +334,7 @@ public final class Mapper { Context[] contexts = host.contextList.contexts; int pos2 = find(contexts, contextPath); if( pos2<0 ) { - logger.error("No context found: " + contextPath ); + log.error("No context found: " + contextPath ); return; } Context context = contexts[pos2]; @@ -455,6 +461,11 @@ public final class Mapper { } protected void removeWrapper(Context context, String path) { + + if (log.isDebugEnabled()) { + log.debug(sm.getString("mapper.removeWrapper", context, path)); + } + synchronized (context) { if (path.endsWith("/*")) { // Wildcard wrapper -- 2.11.0