mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8429: Merged V2.1 to V2.2 8387: Fix for WCM-1090 see ACT 1551 8421: Minor typo fix to OpenOffice document formats descriptions 8422: Fixed AR-2145: ContentStore cleaner was not watching out for VM shutdowns 8423: Removal of default root objects responsible git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8510 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -45,6 +45,7 @@ import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.alfresco.util.VmShutdownListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -60,6 +61,9 @@ public class ContentStoreCleaner
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(ContentStoreCleaner.class);
|
||||
|
||||
/** kept to notify the thread that it should quit */
|
||||
private static VmShutdownListener vmShutdownListener = new VmShutdownListener("ContentStoreCleaner");
|
||||
|
||||
private DictionaryService dictionaryService;
|
||||
private NodeDaoService nodeDaoService;
|
||||
private AVMNodeDAO avmNodeDAO;
|
||||
@@ -178,6 +182,10 @@ public class ContentStoreCleaner
|
||||
{
|
||||
public void handle(Node node, Serializable value)
|
||||
{
|
||||
if (vmShutdownListener.isVmShuttingDown())
|
||||
{
|
||||
throw new VmShutdownException();
|
||||
}
|
||||
// Convert the values to ContentData and extract the URLs
|
||||
ContentData contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
|
||||
String contentUrl = contentData.getContentUrl();
|
||||
@@ -204,6 +212,10 @@ public class ContentStoreCleaner
|
||||
{
|
||||
public void handle(String contentUrl)
|
||||
{
|
||||
if (vmShutdownListener.isVmShuttingDown())
|
||||
{
|
||||
throw new VmShutdownException();
|
||||
}
|
||||
contentUrlDAO.deleteContentUrl(contentUrl);
|
||||
}
|
||||
};
|
||||
@@ -225,6 +237,10 @@ public class ContentStoreCleaner
|
||||
{
|
||||
public void handle(String contentUrl)
|
||||
{
|
||||
if (vmShutdownListener.isVmShuttingDown())
|
||||
{
|
||||
throw new VmShutdownException();
|
||||
}
|
||||
contentUrlDAO.createContentUrl(contentUrl);
|
||||
}
|
||||
};
|
||||
@@ -251,6 +267,10 @@ public class ContentStoreCleaner
|
||||
{
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (vmShutdownListener.isVmShuttingDown())
|
||||
{
|
||||
throw new VmShutdownException();
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
if (store.isWriteSupported())
|
||||
@@ -280,12 +300,33 @@ public class ContentStoreCleaner
|
||||
return null;
|
||||
};
|
||||
};
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(executeCallback);
|
||||
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
try
|
||||
{
|
||||
logger.debug(" Content store cleanup completed.");
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(executeCallback);
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(" Content store cleanup completed.");
|
||||
}
|
||||
}
|
||||
catch (VmShutdownException e)
|
||||
{
|
||||
// Aborted
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(" Content store cleanup aborted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Message carrier to break out of loops using the callback.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 2.1.3
|
||||
*/
|
||||
private class VmShutdownException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = -5876107469054587072L;
|
||||
}
|
||||
}
|
||||
|
@@ -509,8 +509,9 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
|
||||
// add the global scripts
|
||||
for (ProcessorExtension ex : this.processorExtensions.values())
|
||||
{
|
||||
model.put(ex.getExtensionName(), ex);
|
||||
}
|
||||
model.put(ex.getExtensionName(), ex);
|
||||
}
|
||||
|
||||
|
||||
// insert supplied object model into root of the default scope
|
||||
for (String key : model.keySet())
|
||||
|
Reference in New Issue
Block a user