[Schmitzm-commits] r2030 - trunk/schmitzm-core/src/main/java/de/schmitzm/regex

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sun May 27 21:49:04 CEST 2012


Author: alfonx
Date: 2012-05-27 21:49:04 +0200 (Sun, 27 May 2012)
New Revision: 2030

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-05-27 14:48:13 UTC (rev 2029)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-05-27 19:49:04 UTC (rev 2030)
@@ -1,5 +1,6 @@
 package de.schmitzm.regex;
 
+import java.io.PrintStream;
 import java.util.regex.MatchResult;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -14,8 +15,6 @@
  * 
  * @author stranger
  * @author stefan.tzeggai
- * 
- *         TODO ConcurrentLRUCache von solr einbauen um unendlichen Speicherverbrauch vorzubeugen
  */
 
 public class RegexCache {
@@ -60,6 +59,7 @@
 			100000, 80000);
 
 	private RegexCache() {
+		singletonInstance=this;
 	}
 
 	/**
@@ -230,4 +230,22 @@
 		}
 	}
 
+	public void report(PrintStream out) {
+		org.apache.solr.util.ConcurrentLRUCache.Stats cStats = getPatternCacheStats();
+		out.println("PatternCache     : Hits=" + cStats.getCumulativeHits() + " Lookups="
+				+ cStats.getCumulativeLookups() + " Misses=" + cStats.getCumulativeMisses() + " currentSize="
+				+ cStats.getCurrentSize());
+
+		cStats = getMatcherCacheStats();
+		out.println("MatcherCacheStats: Hits=" + cStats.getCumulativeHits() + " Lookups="
+				+ cStats.getCumulativeLookups() + " Misses=" + cStats.getCumulativeMisses() + " currentSize="
+				+ cStats.getCurrentSize());
+
+		cStats = getResultsCacheStats();
+		out.println("ResultsCacheStats: Hits=" + cStats.getCumulativeHits() + " Lookups="
+				+ cStats.getCumulativeLookups() + " Misses=" + cStats.getCumulativeMisses() + " currentSize="
+				+ cStats.getCurrentSize());
+
+	}
+
 }



More information about the Schmitzm-commits mailing list