mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/V3.2 to HEAD:
19181: Merged V3.1 to V3.2 18999: Merged DEV/BELARUS/V3.1-2010_02_05 to V3.1 (with modifications) 18972: Upgrade EHCache to 1.7.x (latest) 19069: Use compatible slf4j API and implementation libraries git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19268 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,7 +66,7 @@ public class EhCacheManagerFactoryBean implements FactoryBean, InitializingBean,
|
|||||||
{
|
{
|
||||||
URL configUrl = this.configLocation.getURL();
|
URL configUrl = this.configLocation.getURL();
|
||||||
logger.info("Initializing EHCache CacheManager using URL: " + configLocation);
|
logger.info("Initializing EHCache CacheManager using URL: " + configLocation);
|
||||||
this.cacheManager = new CacheManager(configUrl);
|
this.cacheManager = CacheManager.create(configUrl);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
@@ -29,6 +29,7 @@ import net.sf.ehcache.CacheException;
|
|||||||
import net.sf.ehcache.CacheManager;
|
import net.sf.ehcache.CacheManager;
|
||||||
import net.sf.ehcache.Element;
|
import net.sf.ehcache.Element;
|
||||||
import net.sf.ehcache.Status;
|
import net.sf.ehcache.Status;
|
||||||
|
import net.sf.ehcache.statistics.LiveCacheStatistics;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -188,10 +189,11 @@ public class EhCacheTracerJob implements Job
|
|||||||
size = count > 0 ? (long) ((double)size * ((double)keys.size()/(double)count)) : 0L;
|
size = count > 0 ? (long) ((double)size * ((double)keys.size()/(double)count)) : 0L;
|
||||||
|
|
||||||
sizeMB = (double)size/1024.0/1024.0;
|
sizeMB = (double)size/1024.0/1024.0;
|
||||||
maxSize = cache.getMaxElementsInMemory();
|
LiveCacheStatistics statistics = cache.getLiveCacheStatistics();
|
||||||
|
maxSize = cache.getCacheConfiguration().getMaxElementsInMemory();
|
||||||
currentSize = cache.getMemoryStoreSize();
|
currentSize = cache.getMemoryStoreSize();
|
||||||
hitCount = cache.getHitCount();
|
hitCount = statistics.getCacheHitCount();
|
||||||
missCount = cache.getMissCountNotFound();
|
missCount = statistics.getCacheMissCount();
|
||||||
percentageFull = (double)currentSize / (double)maxSize * 100.0;
|
percentageFull = (double)currentSize / (double)maxSize * 100.0;
|
||||||
estMaxSize = size / (double) currentSize * (double) maxSize;
|
estMaxSize = size / (double) currentSize * (double) maxSize;
|
||||||
}
|
}
|
||||||
@@ -220,10 +222,11 @@ public class EhCacheTracerJob implements Job
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
double sizeMB = (double)getSize()/1024.0/1024.0;
|
double sizeMB = (double)getSize()/1024.0/1024.0;
|
||||||
long maxSize = cache.getMaxElementsInMemory();
|
LiveCacheStatistics statistics = cache.getLiveCacheStatistics();
|
||||||
|
long maxSize = cache.getCacheConfiguration().getMaxElementsInMemory();
|
||||||
long currentSize = cache.getMemoryStoreSize();
|
long currentSize = cache.getMemoryStoreSize();
|
||||||
long hitCount = cache.getHitCount();
|
long hitCount = statistics.getCacheHitCount();
|
||||||
long totalMissCount = cache.getMissCountNotFound() + cache.getMissCountExpired();
|
long totalMissCount = statistics.getCacheMissCount() + statistics.getCacheMissCountExpired();
|
||||||
double hitRatio = (double)hitCount / (double)(totalMissCount + hitCount) * 100.0;
|
double hitRatio = (double)hitCount / (double)(totalMissCount + hitCount) * 100.0;
|
||||||
double percentageFull = (double)currentSize / (double)maxSize * 100.0;
|
double percentageFull = (double)currentSize / (double)maxSize * 100.0;
|
||||||
double estMaxSize = sizeMB / (double) currentSize * (double) maxSize;
|
double estMaxSize = sizeMB / (double) currentSize * (double) maxSize;
|
||||||
|
@@ -99,7 +99,7 @@ public class InternalEhCacheManagerFactoryBean implements FactoryBean<CacheManag
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
URL configUrl = ResourceUtils.getURL(CUSTOM_CONFIGURATION_FILE);
|
URL configUrl = ResourceUtils.getURL(CUSTOM_CONFIGURATION_FILE);
|
||||||
InternalEhCacheManagerFactoryBean.cacheManager = new CacheManager(configUrl);
|
InternalEhCacheManagerFactoryBean.cacheManager = CacheManager.create(configUrl);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
catch (FileNotFoundException e)
|
||||||
{
|
{
|
||||||
@@ -109,7 +109,7 @@ public class InternalEhCacheManagerFactoryBean implements FactoryBean<CacheManag
|
|||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Missing default cache config: " + DEFAULT_CONFIGURATION_FILE);
|
throw new AlfrescoRuntimeException("Missing default cache config: " + DEFAULT_CONFIGURATION_FILE);
|
||||||
}
|
}
|
||||||
InternalEhCacheManagerFactoryBean.cacheManager = new CacheManager(configUrl);
|
InternalEhCacheManagerFactoryBean.cacheManager = CacheManager.create(configUrl);
|
||||||
defaultLocation = true;
|
defaultLocation = true;
|
||||||
}
|
}
|
||||||
// done
|
// done
|
||||||
|
@@ -62,7 +62,7 @@ public abstract class AbstractLoaderThread extends Thread
|
|||||||
{
|
{
|
||||||
System.setProperty(CacheManager.ENABLE_SHUTDOWN_HOOK_PROPERTY, "TRUE");
|
System.setProperty(CacheManager.ENABLE_SHUTDOWN_HOOK_PROPERTY, "TRUE");
|
||||||
URL url = LoaderUploadThread.class.getResource("/org/alfresco/repo/model/filefolder/loader/loader-ehcache.xml");
|
URL url = LoaderUploadThread.class.getResource("/org/alfresco/repo/model/filefolder/loader/loader-ehcache.xml");
|
||||||
CacheManager cacheManager = new CacheManager(url);
|
CacheManager cacheManager = CacheManager.create(url);
|
||||||
Cache cache = cacheManager.getCache("org.alfresco.LoaderUploadThread.PathCache");
|
Cache cache = cacheManager.getCache("org.alfresco.LoaderUploadThread.PathCache");
|
||||||
|
|
||||||
pathCache = new EhCacheAdapter<String, NodeRef>();
|
pathCache = new EhCacheAdapter<String, NodeRef>();
|
||||||
|
Reference in New Issue
Block a user