From commits-return-15053-apmail-commons-commits-archive=commons.apache.org@commons.apache.org Tue Dec 21 17:11:54 2010 Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 49301 invoked from network); 21 Dec 2010 17:11:53 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Dec 2010 17:11:53 -0000 Received: (qmail 69154 invoked by uid 500); 21 Dec 2010 17:11:53 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 69095 invoked by uid 500); 21 Dec 2010 17:11:53 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 69088 invoked by uid 99); 21 Dec 2010 17:11:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Dec 2010 17:11:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Dec 2010 17:11:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BCB352388A4B; Tue, 21 Dec 2010 17:11:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1051562 - in /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2: JexlEngine.java UnifiedJEXL.java Date: Tue, 21 Dec 2010 17:11:32 -0000 To: commits@commons.apache.org From: henrib@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101221171132.BCB352388A4B@eris.apache.org> Author: henrib Date: Tue Dec 21 17:11:32 2010 New Revision: 1051562 URL: http://svn.apache.org/viewvc?rev=1051562&view=rev Log: Added explicit clear cache methods Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java?rev=1051562&r1=1051561&r2=1051562&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java Tue Dec 21 17:11:32 2010 @@ -729,6 +729,13 @@ public class JexlEngine { } /** + * Clears the cache. + */ + void clear() { + ref = null; + } + + /** * Produces the cache entry set. * @return the cache entry set */ @@ -772,7 +779,7 @@ public class JexlEngine { protected Map createCache(final int cacheSize) { return new java.util.LinkedHashMap(cacheSize, LOAD_FACTOR, true) { /** Serial version UID. */ - private static final long serialVersionUID = 3801124242820219131L; + private static final long serialVersionUID = 1L; @Override protected boolean removeEldestEntry(Map.Entry eldest) { @@ -782,6 +789,15 @@ public class JexlEngine { } /** + * Clears the expression cache. + */ + public void clearCache() { + synchronized(parser) { + cache.clear(); + } + } + + /** * Parses an expression. * @param expression the expression to parse * @param info debug information structure @@ -868,7 +884,7 @@ public class JexlEngine { * @param str expression to clean * @return trimmed expression ending in a semi-colon */ - public static final String cleanExpression(CharSequence str) { + public static String cleanExpression(CharSequence str) { if (str != null) { int start = 0; int end = str.length(); @@ -895,7 +911,7 @@ public class JexlEngine { * @return the contents of the reader as a String. * @throws IOException on any error reading the reader. */ - public static final String readerToString(Reader scriptReader) throws IOException { + public static String readerToString(Reader scriptReader) throws IOException { StringBuilder buffer = new StringBuilder(); BufferedReader reader; if (scriptReader instanceof BufferedReader) { Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java?rev=1051562&r1=1051561&r2=1051562&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java Tue Dec 21 17:11:32 2010 @@ -192,6 +192,15 @@ public final class UnifiedJEXL { } /** + * Clears the cache. + */ + public void clearCache() { + synchronized(cache) { + cache.clear(); + } + } + + /** * The sole type of (runtime) exception the UnifiedJEXL can throw. */ public static class Exception extends RuntimeException {