diff --git a/source/java/org/alfresco/repo/model/filefolder/loader/LoaderUploadThread.java b/source/java/org/alfresco/repo/model/filefolder/loader/LoaderUploadThread.java index ef866e518a..421cab2ddb 100644 --- a/source/java/org/alfresco/repo/model/filefolder/loader/LoaderUploadThread.java +++ b/source/java/org/alfresco/repo/model/filefolder/loader/LoaderUploadThread.java @@ -25,6 +25,7 @@ package org.alfresco.repo.model.filefolder.loader; import java.io.File; +import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -50,9 +51,10 @@ public class LoaderUploadThread extends AbstractLoaderThread static { - CacheManager cacheManager = new CacheManager(); - Cache cache = new Cache("LoaderUploadThread-PathCache", 100000, false, false, 300, 300); - cacheManager.addCache(cache); + System.setProperty(CacheManager.ENABLE_SHUTDOWN_HOOK_PROPERTY, "TRUE"); + URL url = LoaderUploadThread.class.getResource("/org/alfresco/repo/model/filefolder/loader/loader-ehcache.xml"); + CacheManager cacheManager = new CacheManager(url); + Cache cache = cacheManager.getCache("org.alfresco.LoaderUploadThread.PathCache"); pathCache = new EhCacheAdapter(); pathCache.setCache(cache); @@ -81,12 +83,13 @@ public class LoaderUploadThread extends AbstractLoaderThread // Iterate down the path, checking the cache and populating it as necessary List currentPath = new ArrayList(); NodeRef currentParentNodeRef = workingRootNodeRef; + String currentKey = workingRootNodeRef.toString(); for (String pathElement : folderPath) { currentPath.add(pathElement); - String key = currentPath.toString(); + currentKey += ("/" + pathElement); // Is this there? - NodeRef nodeRef = pathCache.get(key); + NodeRef nodeRef = pathCache.get(currentKey); if (nodeRef != null) { // Found it @@ -102,7 +105,7 @@ public class LoaderUploadThread extends AbstractLoaderThread ContentModel.TYPE_FOLDER); currentParentNodeRef = folderInfo.getNodeRef(); // Cache the new node - pathCache.put(key, currentParentNodeRef); + pathCache.put(currentKey, currentParentNodeRef); } // Done return currentParentNodeRef; diff --git a/source/java/org/alfresco/repo/model/filefolder/loader/loader-ehcache.xml b/source/java/org/alfresco/repo/model/filefolder/loader/loader-ehcache.xml new file mode 100644 index 0000000000..41778f4adc --- /dev/null +++ b/source/java/org/alfresco/repo/model/filefolder/loader/loader-ehcache.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + \ No newline at end of file