ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1030034 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
Date Tue, 02 Nov 2010 13:19:56 GMT
Author: hibou
Date: Tue Nov  2 13:19:55 2010
New Revision: 1030034

URL: http://svn.apache.org/viewvc?rev=1030034&view=rev
Log:
IVY-1243 : when useCacheOnly is used, don't do any TTL check

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1030034&r1=1030033&r2=1030034&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Nov  2 13:19:55 2010
@@ -119,6 +119,7 @@ for detailed view of each issue, please 
 - FIX: OutOfMemoryError when uploading large files using commons-httpclient (IVY-1197) (thanks
to Torkild U. Resheim)
 - FIX: Only the last dependency descriptor is taken into account on the same module (IVY-1240)
 - FIX: UseCacheOnly doesn't respect the cache configuration in the ivysettings (IVY-1227)
+- FIX: UseCacheOnly is influenced by the TTL on cached metadata (IVY-1243)
 
    2.2.0
 =====================================

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java?rev=1030034&r1=1030033&r2=1030034&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java Tue Nov
 2 13:19:55 2010
@@ -25,6 +25,7 @@ public class CacheMetadataOptions extend
     private Boolean isCheckmodified = null;
     private String changingMatcherName = null;
     private String changingPattern = null;
+    private boolean checkTTL = true;
     
     public Namespace getNamespace() {
         return namespace;
@@ -61,4 +62,11 @@ public class CacheMetadataOptions extend
         this.changingPattern  = changingPattern;
         return this;
     }
+    public CacheMetadataOptions setCheckTTL(boolean checkTTL) {
+        this.checkTTL = checkTTL;
+        return this;
+    }
+    public boolean isCheckTTL() {
+        return checkTTL;
+    }
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=1030034&r1=1030033&r2=1030034&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Tue Nov  2 13:19:55 2010
@@ -701,12 +701,14 @@ public class DefaultRepositoryCacheManag
                     + ": inconsistent or old cache: no cached resolved time for " + mrid);
                 saveResolvedRevision(mrid, resolvedRevision);
                 return resolvedRevision;
-            } 
-            long expiration = Long.parseLong(resolvedTime) + getTTL(mrid);
-            if (expiration > 0 // negative expiration means that Long.MAX_VALUE has been
exceeded
-                    && System.currentTimeMillis() > expiration) {
-                Message.verbose(getName() + ": cached resolved revision expired for " + mrid);
-                return null;
+            }
+            if (options.isCheckTTL()) {
+                long expiration = Long.parseLong(resolvedTime) + getTTL(mrid);
+                if (expiration > 0 // negative expiration means that Long.MAX_VALUE has
been exceeded
+                        && System.currentTimeMillis() > expiration) {
+                    Message.verbose(getName() + ": cached resolved revision expired for "
+ mrid);
+                    return null;
+                }
             }
             return resolvedRevision;
         } finally {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java?rev=1030034&r1=1030033&r2=1030034&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java Tue
Nov  2 13:19:55 2010
@@ -436,6 +436,7 @@ public abstract class AbstractResolver 
         return (CacheMetadataOptions) new CacheMetadataOptions()
             .setChangingMatcherName(getChangingMatcherName())
             .setChangingPattern(getChangingPattern())
+            .setCheckTTL(!data.getOptions().isUseCacheOnly())
             .setCheckmodified(data.getOptions().isUseCacheOnly() ? Boolean.FALSE : checkmodified)
             .setValidate(doValidate(data))
             .setNamespace(getNamespace())



Mime
View raw message