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
This commit is contained in:
Olivier Lamy 2012-12-20 23:03:36 +00:00
parent a42f107bac
commit 1c1134b74f
3 changed files with 21 additions and 12 deletions

View File

@ -20,22 +20,21 @@ package org.apache.archiva.policies.urlcache;
*/ */
import org.apache.archiva.redback.components.cache.Cache; import org.apache.archiva.redback.components.cache.Cache;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.util.Date; import java.util.Date;
/** /**
* DefaultUrlFailureCache * DefaultUrlFailureCache
*
*
*/ */
@Service( "urlFailureCache" )
public class DefaultUrlFailureCache public class DefaultUrlFailureCache
implements UrlFailureCache implements UrlFailureCache
{ {
/**
* @todo spring cache instead
*/
private Cache urlCache; private Cache urlCache;
@Inject
public DefaultUrlFailureCache( Cache urlCache ) public DefaultUrlFailureCache( Cache urlCache )
{ {
this.urlCache = urlCache; this.urlCache = urlCache;

View File

@ -33,12 +33,7 @@
<context:annotation-config/> <context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.policies"/> <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" <bean id="url-failures-cache" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache" lazy-init="true"
destroy-method="dispose"> destroy-method="dispose">

View File

@ -161,6 +161,21 @@
<property name="timeToLiveSeconds" value="14400"/> <property name="timeToLiveSeconds" value="14400"/>
</bean> </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 --> <!-- override jcr repository location -->
<!-- START SNIPPET: jcr-location --> <!-- START SNIPPET: jcr-location -->
<!-- <!--