ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r737354 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
Date Sat, 24 Jan 2009 13:00:16 GMT
Author: xavier
Date: Sat Jan 24 13:00:16 2009
New Revision: 737354

URL: http://svn.apache.org/viewvc?rev=737354&view=rev
Log:
IMPROVEMENT: Remove excessive HEAD requests for URL repository (IVY-996)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=737354&r1=737353&r2=737354&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Sat Jan 24 13:00:16 2009
@@ -85,6 +85,7 @@
 	
    trunk
 =====================================
+- IMPROVEMENT: Remove excessive HEAD requests for URL repository (IVY-996)
 - IMPROVEMENT: add -version option on command line (IVY-1014)
 - IMPROVEMENT: support resolve refresh in command line (IVY-1013)
 - IMPROVEMENT: Error message is not clear when specifying an invalid value for checksums
(IVY-977)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java?rev=737354&r1=737353&r2=737354&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
Sat Jan 24 13:00:16 2009
@@ -127,15 +127,14 @@
         
         for (ListIterator iter = sorted.listIterator(sorted.size()); iter.hasPrevious();)
{
             ResolvedResource rres = (ResolvedResource) iter.previous();
+            // we start by filtering based on information already available,
+            // even though we don't even know if the resource actually exist.
+            // But checking for existence is most of the time more costly than checking 
+            // name, blacklisting and first level version matching
             if (filterNames(new ArrayList(Collections.singleton(rres.getRevision()))).isEmpty())
{
                 Message.debug("\t" + name + ": filtered by name: " + rres);
                 continue;
             }
-            if ((date != null && rres.getLastModified() > date.getTime())) {
-                Message.verbose("\t" + name + ": too young: " + rres);
-                rejected.add(rres.getRevision() + " (" + rres.getLastModified() + ")");
-                continue;
-            }
             ModuleRevisionId foundMrid = ModuleRevisionId.newInstance(mrid, rres.getRevision());
             
             ResolveData data = context.getResolveData();
@@ -153,6 +152,17 @@
                 rejected.add(rres.getRevision());
                 continue;
             }
+            if (!rres.getResource().exists()) {
+                Message.debug("\t" + name + ": unreachable: " + rres 
+                    + "; res=" + rres.getResource());
+                rejected.add(rres.getRevision() + " (unreachable)");
+                continue;
+            }
+            if ((date != null && rres.getLastModified() > date.getTime())) {
+                Message.verbose("\t" + name + ": too young: " + rres);
+                rejected.add(rres.getRevision() + " (" + rres.getLastModified() + ")");
+                continue;
+            }
             if (versionMatcher.needModuleDescriptor(mrid, foundMrid)) {
                 ResolvedResource r = rmdparser.parse(rres.getResource(), rres.getRevision());
                 if (r == null) {
@@ -180,12 +190,6 @@
             }
 
             if (found != null) {
-                if (!found.getResource().exists()) {
-                    Message.debug("\t" + name + ": resource not reachable for " + mrid +
": res="
-                            + found.getResource());
-                    logAttempt(found.getResource().toString());
-                    continue;
-                }
                 break;
             }
         }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java?rev=737354&r1=737353&r2=737354&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java Sat
Jan 24 13:00:16 2009
@@ -153,7 +153,10 @@
                     IvyPatternHelper.REVISION_KEY, revs[i]);
                 try {
                     Resource res = rep.getResource(rres);
-                    if ((res != null) && res.exists()) {
+                    if (res != null) {
+                        // we do not test if the resource actually exist here, it would cause
+                        // a lot of checks which are not always necessary depending on the
usage
+                        // which is done of the returned ResolvedResource array
                         ret.add(new ResolvedResource(res, revs[i]));
                     }
                 } catch (IOException e) {



Mime
View raw message