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
This commit is contained in:
Olivier Lamy 2012-12-21 17:54:19 +00:00
parent 738de86c70
commit 523213b737
1 changed files with 11 additions and 0 deletions

View File

@ -39,6 +39,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.naming.InvalidNameException; import javax.naming.InvalidNameException;
@ -76,6 +77,16 @@ public class DefaultRedbackRuntimeConfigurationService
@Named( value = "cache#users" ) @Named( value = "cache#users" )
private Cache usersCache; private Cache usersCache;
@PostConstruct
public void initialize()
throws RepositoryAdminException
{
RedbackRuntimeConfiguration redbackRuntimeConfiguration =
redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
usersCache.setTimeToIdleSeconds( redbackRuntimeConfiguration.getUseUsersCacheTimeToIdleSeconds() );
usersCache.setTimeToLiveSeconds( redbackRuntimeConfiguration.getUseUsersCacheTimeToLiveSeconds() );
}
public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration() public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
throws ArchivaRestServiceException throws ArchivaRestServiceException
{ {