public LinkedWorkspaceStorageCacheImpl(WorkspaceEntry wsConfig) throws RepositoryConfigurationException
{
this.name = "jcr." + wsConfig.getUniqueName();
CacheEntry cacheConfig = wsConfig.getCache();
long statisticPeriod;
long cleanerPeriod;
boolean cleanStats;
int blockingUsers;
boolean showStatistic;
if (cacheConfig != null)
{
this.enabled = cacheConfig.isEnabled();
int maxSizeConf;
try
{
maxSizeConf = cacheConfig.getParameterInteger(MAX_SIZE_PARAMETER_NAME);
}
catch (RepositoryConfigurationException e)
{
maxSizeConf = cacheConfig.getParameterInteger("maxSize");
}
this.maxSize = maxSizeConf;
int initialSize = maxSize > MAX_CACHE_SIZE ? maxSize / 4 : maxSize;
this.nodesCache = new WeakHashMap<String, List<NodeData>>(initialSize, LOAD_FACTOR);
this.propertiesCache = new WeakHashMap<String, List<PropertyData>>(initialSize, LOAD_FACTOR);
try
{
// apply in milliseconds
this.liveTime = cacheConfig.getParameterTime(LIVE_TIME_PARAMETER_NAME);
}
catch (RepositoryConfigurationException e)
{
this.liveTime = cacheConfig.getParameterTime("liveTime");
}
this.deepDelete = cacheConfig.getParameterBoolean(DEEP_DELETE_PARAMETER_NAME, false);
blockingUsers = cacheConfig.getParameterInteger(BLOCKING_USERS_COUNT_PARAMETER_NAME, DEF_BLOCKING_USERS_COUNT);
cleanerPeriod = cacheConfig.getParameterTime(CLEANER_PERIOD_PARAMETER_NAME, DEF_CLEANER_PERIOD);
cleanStats = cacheConfig.getParameterBoolean(STATISTIC_CLEAN_PARAMETER_NAME, true);
statisticPeriod = cacheConfig.getParameterTime(STATISTIC_PERIOD_PARAMETER_NAME, DEF_STATISTIC_PERIOD);
showStatistic = cacheConfig.getParameterBoolean(STATISTIC_LOG_PARAMETER_NAME, false);
}
else
{
this.maxSize = MAX_CACHE_SIZE;