mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-9613: caching content store. Various improvements and bug fixes. Including:
ALF-10097: disk-persistent cache settings in ehcache ALF-10098: clean up process should remove empty parent directories from content cache disk directory ALF-10126: timeToIdle ehcache property was not affecting cache cleaner job ALF-10127: externally deleted cached content files were not re-cached until after the items expired from ehcache git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30171 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,6 +34,7 @@ import org.alfresco.repo.content.UnsupportedContentUrlException;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.Deleter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -613,7 +614,7 @@ public class FileContentStore
|
||||
// Delete empty parents regardless of whether the file was ignore above.
|
||||
if (deleteEmptyDirs && deleted)
|
||||
{
|
||||
deleteEmptyParents(file);
|
||||
Deleter.deleteEmptyParents(file, getRootLocation());
|
||||
}
|
||||
|
||||
// done
|
||||
@@ -626,38 +627,7 @@ public class FileContentStore
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the parents of the specified file. The file itself must have been
|
||||
* deleted before calling this method - since only empty directories can be deleted.
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
private void deleteEmptyParents(File file)
|
||||
{
|
||||
String root = getRootLocation();
|
||||
File parent = file.getParentFile();
|
||||
boolean deleted = false;
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
if (parent.isDirectory() && !parent.getCanonicalPath().equals(root))
|
||||
{
|
||||
// Only an empty directory will successfully be deleted.
|
||||
deleted = parent.delete();
|
||||
}
|
||||
}
|
||||
catch (IOException error)
|
||||
{
|
||||
logger.error("Unable to construct canonical path for " + parent.getAbsolutePath());
|
||||
break;
|
||||
}
|
||||
|
||||
parent = parent.getParentFile();
|
||||
}
|
||||
while(deleted);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new content URL. This must be supported by all
|
||||
|
Reference in New Issue
Block a user