mirror of https://github.com/apache/archiva.git
configure maxElementsInMemory and maxElementsOnDisk
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1426342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62992df826
commit
ce9d2fce63
|
@ -39,6 +39,16 @@ public class CacheConfiguration
|
||||||
*/
|
*/
|
||||||
private int timeToLiveSeconds = -1;
|
private int timeToLiveSeconds = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* max elements in memory.
|
||||||
|
*/
|
||||||
|
private int maxElementsInMemory = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* max elements on disk.
|
||||||
|
*/
|
||||||
|
private int maxElementsOnDisk = -1;
|
||||||
|
|
||||||
public CacheConfiguration()
|
public CacheConfiguration()
|
||||||
{
|
{
|
||||||
// no op
|
// no op
|
||||||
|
@ -64,6 +74,26 @@ public class CacheConfiguration
|
||||||
this.timeToLiveSeconds = timeToLiveSeconds;
|
this.timeToLiveSeconds = timeToLiveSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxElementsInMemory()
|
||||||
|
{
|
||||||
|
return maxElementsInMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxElementsInMemory( int maxElementsInMemory )
|
||||||
|
{
|
||||||
|
this.maxElementsInMemory = maxElementsInMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxElementsOnDisk()
|
||||||
|
{
|
||||||
|
return maxElementsOnDisk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxElementsOnDisk( int maxElementsOnDisk )
|
||||||
|
{
|
||||||
|
this.maxElementsOnDisk = maxElementsOnDisk;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
@ -71,6 +101,8 @@ public class CacheConfiguration
|
||||||
sb.append( "CacheConfiguration" );
|
sb.append( "CacheConfiguration" );
|
||||||
sb.append( "{timeToIdleSeconds=" ).append( timeToIdleSeconds );
|
sb.append( "{timeToIdleSeconds=" ).append( timeToIdleSeconds );
|
||||||
sb.append( ", timeToLiveSeconds=" ).append( timeToLiveSeconds );
|
sb.append( ", timeToLiveSeconds=" ).append( timeToLiveSeconds );
|
||||||
|
sb.append( ", maxElementsInMemory=" ).append( maxElementsInMemory );
|
||||||
|
sb.append( ", maxElementsOnDisk=" ).append( maxElementsOnDisk );
|
||||||
sb.append( '}' );
|
sb.append( '}' );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,24 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
usersCache.setTimeToLiveSeconds(
|
usersCache.setTimeToLiveSeconds(
|
||||||
redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
|
||||||
|
|
||||||
|
if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() < 0 )
|
||||||
|
{
|
||||||
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsInMemory(
|
||||||
|
usersCache.getMaxElementsInMemory() );
|
||||||
|
save = true;
|
||||||
|
}
|
||||||
|
usersCache.setMaxElementsInMemory(
|
||||||
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() );
|
||||||
|
|
||||||
|
if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() < 0 )
|
||||||
|
{
|
||||||
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsOnDisk(
|
||||||
|
usersCache.getMaxElementsOnDisk() );
|
||||||
|
save = true;
|
||||||
|
}
|
||||||
|
usersCache.setMaxElementsOnDisk(
|
||||||
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
|
||||||
|
|
||||||
if ( save )
|
if ( save )
|
||||||
{
|
{
|
||||||
updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
|
updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||||
|
|
|
@ -55,7 +55,7 @@ import java.util.Properties;
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 1.4-M4
|
* @since 1.4-M4
|
||||||
*/
|
*/
|
||||||
@Service( "archivaRuntimeConfigurationService#rest" )
|
@Service("archivaRuntimeConfigurationService#rest")
|
||||||
public class DefaultRedbackRuntimeConfigurationService
|
public class DefaultRedbackRuntimeConfigurationService
|
||||||
extends AbstractRestService
|
extends AbstractRestService
|
||||||
implements RedbackRuntimeConfigurationService
|
implements RedbackRuntimeConfigurationService
|
||||||
|
@ -64,18 +64,18 @@ public class DefaultRedbackRuntimeConfigurationService
|
||||||
private RedbackRuntimeConfigurationAdmin redbackRuntimeConfigurationAdmin;
|
private RedbackRuntimeConfigurationAdmin redbackRuntimeConfigurationAdmin;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named( value = "userManager#configurable" )
|
@Named(value = "userManager#configurable")
|
||||||
private UserManager userManager;
|
private UserManager userManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named( value = "ldapConnectionFactory#configurable" )
|
@Named(value = "ldapConnectionFactory#configurable")
|
||||||
private LdapConnectionFactory ldapConnectionFactory;
|
private LdapConnectionFactory ldapConnectionFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named( value = "cache#users" )
|
@Named(value = "cache#users")
|
||||||
private Cache usersCache;
|
private Cache usersCache;
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,6 +144,10 @@ public class DefaultRedbackRuntimeConfigurationService
|
||||||
redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() );
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() );
|
||||||
usersCache.setTimeToLiveSeconds(
|
usersCache.setTimeToLiveSeconds(
|
||||||
redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
|
||||||
|
usersCache.setMaxElementsInMemory(
|
||||||
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() );
|
||||||
|
usersCache.setMaxElementsOnDisk(
|
||||||
|
redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,5 +639,7 @@ redback.runtime.usersCacheTimeToLiveSeconds.help.content=
|
||||||
redback.runtime.usersCacheTimeToIdleSeconds.label=Time to Idle (seconds)
|
redback.runtime.usersCacheTimeToIdleSeconds.label=Time to Idle (seconds)
|
||||||
redback.runtime.usersCacheTimeToIdleSeconds.help.title=
|
redback.runtime.usersCacheTimeToIdleSeconds.help.title=
|
||||||
redback.runtime.usersCacheTimeToIdleSeconds.help.content=
|
redback.runtime.usersCacheTimeToIdleSeconds.help.content=
|
||||||
|
redback.runtime.maxElementsInMemory.label=Max Elements in memory
|
||||||
|
redback.runtime.maxElementsOnDisk.label=Max Elements on disk
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1504,6 +1504,16 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
digits: true,
|
digits: true,
|
||||||
min: 1,
|
min: 1,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
maxElementsInMemory : {
|
||||||
|
digits: true,
|
||||||
|
min: 1,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
maxElementsOnDisk : {
|
||||||
|
digits: true,
|
||||||
|
min: 1,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showErrors: function(validator, errorMap, errorList) {
|
showErrors: function(validator, errorMap, errorList) {
|
||||||
|
@ -1563,7 +1573,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheConfiguration=function(timeToIdleSeconds,timeToLiveSeconds){
|
CacheConfiguration=function(timeToIdleSeconds,timeToLiveSeconds,maxElementsInMemory,maxElementsOnDisk){
|
||||||
var self=this;
|
var self=this;
|
||||||
this.modified=ko.observable(false);
|
this.modified=ko.observable(false);
|
||||||
|
|
||||||
|
@ -1573,13 +1583,19 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
this.timeToLiveSeconds=ko.observable(timeToLiveSeconds);
|
this.timeToLiveSeconds=ko.observable(timeToLiveSeconds);
|
||||||
this.timeToLiveSeconds.subscribe(function(newValue){self.modified(true)});
|
this.timeToLiveSeconds.subscribe(function(newValue){self.modified(true)});
|
||||||
|
|
||||||
|
this.maxElementsInMemory=ko.observable(maxElementsInMemory);
|
||||||
|
this.maxElementsInMemory.subscribe(function(newValue){self.modified(true)});
|
||||||
|
|
||||||
|
this.maxElementsOnDisk=ko.observable(maxElementsOnDisk);
|
||||||
|
this.maxElementsOnDisk.subscribe(function(newValue){self.modified(true)});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapCacheConfiguration=function(data){
|
mapCacheConfiguration=function(data){
|
||||||
if(!data){
|
if(!data){
|
||||||
return new CacheConfiguration();
|
return new CacheConfiguration();
|
||||||
}
|
}
|
||||||
return new CacheConfiguration(data.timeToIdleSeconds,data.timeToLiveSeconds);
|
return new CacheConfiguration(data.timeToIdleSeconds,data.timeToLiveSeconds,data.maxElementsInMemory,data.maxElementsOnDisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
|
@ -1054,6 +1054,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="maxElementsInMemory">${$.i18n.prop('redback.runtime.maxElementsInMemory.label')}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="xlarge required numeric" data-bind="value: redbackRuntimeConfiguration().usersCacheConfiguration().maxElementsInMemory"
|
||||||
|
id="maxElementsInMemory" name="maxElementsInMemory" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="maxElementsOnDisk">${$.i18n.prop('redback.runtime.maxElementsOnDisk.label')}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="xlarge required numeric" data-bind="value: redbackRuntimeConfiguration().usersCacheConfiguration().maxElementsOnDisk"
|
||||||
|
id="maxElementsOnDisk" name="maxElementsOnDisk" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue