diff options
author | Olivier Lamy <olamy@apache.org> | 2012-12-20 23:03:36 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-12-20 23:03:36 +0000 |
commit | 1c1134b74f5fb4a71e5ab30cfe59545d0265b3e1 (patch) | |
tree | 2a6f177140cb8e0456ab21fccea3d068cc467c66 /archiva-modules | |
parent | a42f107baca4485311ef6c3cf8cada88a3372540 (diff) | |
download | archiva-1c1134b74f5fb4a71e5ab30cfe59545d0265b3e1.tar.gz archiva-1c1134b74f5fb4a71e5ab30cfe59545d0265b3e1.zip |
use a more modern way to init this bean
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1424744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
3 files changed, 21 insertions, 12 deletions
diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java index 912ca775d..e1a5b9a69 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java +++ b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java @@ -20,22 +20,21 @@ package org.apache.archiva.policies.urlcache; */ import org.apache.archiva.redback.components.cache.Cache; +import org.springframework.stereotype.Service; +import javax.inject.Inject; import java.util.Date; /** - * DefaultUrlFailureCache - * - * + * DefaultUrlFailureCache */ +@Service( "urlFailureCache" ) public class DefaultUrlFailureCache implements UrlFailureCache { - /** - * @todo spring cache instead - */ private Cache urlCache; + @Inject public DefaultUrlFailureCache( Cache urlCache ) { this.urlCache = urlCache; diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml index 3cf02da6a..a474a2cb3 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml @@ -33,12 +33,7 @@ <context:annotation-config/> <context:component-scan base-package="org.apache.archiva.policies"/> - <bean id="urlFailureCache" - class="org.apache.archiva.policies.urlcache.DefaultUrlFailureCache" lazy-init="true"> - <!-- collaborators and configuration for this bean go here --> - <constructor-arg ref="url-failures-cache" - type="org.apache.archiva.redback.components.cache.Cache"/> - </bean> + <bean id="url-failures-cache" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache" lazy-init="true" destroy-method="dispose"> diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml index 66dd17f58..bbd799b6b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml @@ -161,6 +161,21 @@ <property name="timeToLiveSeconds" value="14400"/> </bean> + <bean id="url-failures-cache" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache" lazy-init="true" + destroy-method="dispose"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="true"/> + <property name="diskStorePath" value="${java.io.tmpdir}/archiva/urlcache"/> + <property name="maxElementsInMemory" value="1000"/> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="url-failures-cache"/> + <property name="overflowToDisk" value="false"/> + <!-- 45 minutes = 2700 seconds --> + <property name="timeToIdleSeconds" value="2700"/> + <!-- 30 minutes = 1800 seconds --> + <property name="timeToLiveSeconds" value="1800"/> + </bean> + <!-- override jcr repository location --> <!-- START SNIPPET: jcr-location --> <!-- |