]> source.dussan.org Git - archiva.git/commitdiff
skip when URL is in failure cache
authorNicolas De Loof <nicolas@apache.org>
Thu, 10 Jan 2008 11:00:35 +0000 (11:00 +0000)
committerNicolas De Loof <nicolas@apache.org>
Thu, 10 Jan 2008 11:00:35 +0000 (11:00 +0000)
cache proxy failures (404) for better performances

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@610758 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java

index 7a34cf895956b8e13a2fe564e80795911c93150d..be4ad11126da7861c52b3a2475dc3bcdabfd5163 100644 (file)
@@ -524,10 +524,15 @@ public class DefaultRepositoryProxyConnectors
             getLogger().info( emsg );
             return null;
         }
-
+       
+               if ( urlFailureCache.hasFailedBefore( url ) )
+               {
+                       throw new NotFoundException( "Url has failed before and cache-failure is enabled on this connector" );
+               }
+                       
         Wagon wagon = null;
         try
-        {
+        {      
             RepositoryURL repoUrl = remoteRepository.getURL();
             String protocol = repoUrl.getProtocol();
             wagon = (Wagon) wagons.get( protocol );
@@ -547,7 +552,10 @@ public class DefaultRepositoryProxyConnectors
         }
         catch ( NotFoundException e )
         {
-            // Do not cache url here.
+                       // public repositories may be slow to access, and many request will fail when 
+                       // muliple repositories are "merged" by archiva via proxies.
+                       // so caching "not found" is usefull here to enhance archiva response-time
+            urlFailureCache.cacheFailure( url );                       
             throw e;
         }
         catch ( NotModifiedException e )