ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1507322 - /ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java
Date Fri, 26 Jul 2013 14:21:37 GMT
Author: marrs
Date: Fri Jul 26 14:21:37 2013
New Revision: 1507322

URL: http://svn.apache.org/r1507322
Log:
Cache was using a weak instead of a soft reference, which means it got lost on every garbage
collection, making it way less effective.

Modified:
    ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java

Modified: ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java?rev=1507322&r1=1507321&r2=1507322&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java
(original)
+++ ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java
Fri Jul 26 14:21:37 2013
@@ -26,11 +26,13 @@ import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
 import java.lang.ref.WeakReference;
 import java.net.URL;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Matcher;
@@ -77,7 +79,6 @@ public class VelocityArtifactPreprocesso
 
     @Override
     public boolean needsNewVersion(String url, PropertyResolver props, String targetID, String
fromVersion) {
-
         byte[] input = null;
         byte[] result = null;
         try {
@@ -312,7 +313,7 @@ public class VelocityArtifactPreprocesso
                 baos.write(buf, 0, count);
             }
             result = baos.toByteArray();
-            m_cachedArtifacts.put(url, new WeakReference<byte[]>(result));
+            m_cachedArtifacts.put(url, new SoftReference<byte[]>(result));
         }
         finally {
             silentlyClose(in);



Mime
View raw message