no need to read the configuration every time

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1436467 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-21 16:36:55 +00:00
parent b711ad5ff6
commit da4adf3f65
1 changed files with 8 additions and 12 deletions

View File

@ -42,7 +42,7 @@ import java.util.Map;
* @author Olivier Lamy * @author Olivier Lamy
* @since 1.4-M4 * @since 1.4-M4
*/ */
@Service("userManager#archiva") @Service( "userManager#archiva" )
public class ArchivaConfigurableUsersManager public class ArchivaConfigurableUsersManager
extends ConfigurableUserManager extends ConfigurableUserManager
{ {
@ -58,8 +58,10 @@ public class ArchivaConfigurableUsersManager
private List<UserManagerListener> listeners = new ArrayList<UserManagerListener>(); private List<UserManagerListener> listeners = new ArrayList<UserManagerListener>();
@Inject @Inject
@Named(value = "cache#users") @Named( value = "cache#users" )
private Cache<String,User> usersCache; private Cache<String, User> usersCache;
private boolean useUsersCache;
@Override @Override
public void initialize() public void initialize()
@ -77,6 +79,8 @@ public class ArchivaConfigurableUsersManager
setUserManagerImpl( userManagerImpl ); setUserManagerImpl( userManagerImpl );
userManagerPerId.put( id, userManagerImpl ); userManagerPerId.put( id, userManagerImpl );
} }
this.useUsersCache = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().isUseUsersCache();
} }
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
@ -88,15 +92,7 @@ public class ArchivaConfigurableUsersManager
protected boolean useUsersCache() protected boolean useUsersCache()
{ {
try return this.useUsersCache;
{
return redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().isUseUsersCache();
}
catch ( RepositoryAdminException e )
{
log.warn( "skip fail to get RedbackRuntimeConfiguration: {}, use false", e.getMessage(), e );
return false;
}
} }
@Override @Override