commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r1177491 - /commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
Date Fri, 30 Sep 2011 03:28:51 GMT
Author: dbrosius
Date: Fri Sep 30 03:28:51 2011
New Revision: 1177491

URL: http://svn.apache.org/viewvc?rev=1177491&view=rev
Log:
avoid unnecessary map allocation

Modified:
    commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java

Modified: commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?rev=1177491&r1=1177490&r2=1177491&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Fri
Sep 30 03:28:51 2011
@@ -159,23 +159,20 @@ public class LateralCache
     protected Map<Serializable, ICacheElement> processGetMatching( String pattern )
         throws IOException
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
-
         if ( this.lateralCacheAttribures.getPutOnlyMode() )
         {
-            return Collections.emptyMap();
+            return Collections.<Serializable, ICacheElement>emptyMap();
         }
         try
         {
-            elements = lateralCacheService.getMatching( cacheName, pattern );
+            return lateralCacheService.getMatching( cacheName, pattern );
         }
         catch ( IOException e )
         {
             log.error( e );
             handleException( e, "Failed to getMatching [" + pattern + "] from " + lateralCacheAttribures.getCacheName()
+ "@" + lateralCacheAttribures );
+            return Collections.<Serializable, ICacheElement>emptyMap();
         }
-
-        return elements;
     }
 
     /**



Mime
View raw message