From 523213b737713663c7706cc6465eaa93c117214f Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 21 Dec 2012 17:54:19 +0000 Subject: [PATCH] initialize users cache on start with our values git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425054 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultRedbackRuntimeConfigurationService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java index eb2e22383..6f9c6b0d7 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java @@ -39,6 +39,7 @@ import org.apache.commons.lang.StringUtils; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; +import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import javax.naming.InvalidNameException; @@ -76,6 +77,16 @@ public class DefaultRedbackRuntimeConfigurationService @Named( value = "cache#users" ) private Cache usersCache; + @PostConstruct + public void initialize() + throws RepositoryAdminException + { + RedbackRuntimeConfiguration redbackRuntimeConfiguration = + redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration(); + usersCache.setTimeToIdleSeconds( redbackRuntimeConfiguration.getUseUsersCacheTimeToIdleSeconds() ); + usersCache.setTimeToLiveSeconds( redbackRuntimeConfiguration.getUseUsersCacheTimeToLiveSeconds() ); + } + public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration() throws ArchivaRestServiceException {