From 679b8921cd531a675a5f54da1a9fd282d4919919 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Thu, 10 Jan 2008 11:00:35 +0000 Subject: [PATCH] skip when URL is in failure cache 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 --- .../proxy/DefaultRepositoryProxyConnectors.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index 7a34cf895..be4ad1112 100644 --- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -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 ) -- 2.39.5