diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java index 36728339a..63dee4f34 100644 --- a/source/de/anomic/http/server/HTTPDFileHandler.java +++ b/source/de/anomic/http/server/HTTPDFileHandler.java @@ -145,7 +145,7 @@ public final class HTTPDFileHandler { final serverSwitch theSwitchboard = Switchboard.getSwitchboard(); useTemplateCache = theSwitchboard.getConfig("enableTemplateCache","true").equalsIgnoreCase("true"); templateCache = (useTemplateCache)? new ConcurrentHashMap>() : new ConcurrentHashMap>(0); - templateMethodCache = (useTemplateCache) ? new ConcurrentHashMap>() : new ConcurrentHashMap>(0); + templateMethodCache = new ConcurrentHashMap>(); if (switchboard == null) { switchboard = theSwitchboard; @@ -1217,7 +1217,7 @@ public final class HTTPDFileHandler { Method m = null; // now make a class out of the stream try { - if (useTemplateCache) { + if (templateMethodCache != null) { final SoftReference ref = templateMethodCache.get(classFile); if (ref != null) { m = ref.get(); @@ -1226,7 +1226,7 @@ public final class HTTPDFileHandler { } else { return m; } - } + } } final Class c = provider.loadClass(classFile); @@ -1236,10 +1236,11 @@ public final class HTTPDFileHandler { serverSwitch.class }; m = c.getMethod("respond", params); - if (useTemplateCache) { + if (MemoryControl.shortStatus()) { + templateMethodCache.clear(); + } else { // storing the method into the cache final SoftReference ref = new SoftReference(m); - if (MemoryControl.shortStatus()) templateMethodCache.clear(); templateMethodCache.put(classFile, ref); }