mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-2238 Added missing BatchProcessWorkProvider implemenations (#793)
This commit is contained in:
@@ -26,12 +26,6 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.admin.patch.impl;
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.admin.patch.AsynchronousPatch;
|
import org.alfresco.repo.admin.patch.AsynchronousPatch;
|
||||||
import org.alfresco.repo.admin.patch.PatchExecuter;
|
import org.alfresco.repo.admin.patch.PatchExecuter;
|
||||||
@@ -55,6 +49,12 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch to add <i>cm:indexControl</i> aspect to sites' surf-config folders and
|
* Patch to add <i>cm:indexControl</i> aspect to sites' surf-config folders and
|
||||||
* their children as well as to the shared surf-config folder(s) and its/their children.
|
* their children as well as to the shared surf-config folder(s) and its/their children.
|
||||||
@@ -382,8 +382,12 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
|||||||
this.siteTypeQNameId = qnameDAO.getQName(SiteModel.TYPE_SITE);
|
this.siteTypeQNameId = qnameDAO.getQName(SiteModel.TYPE_SITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public synchronized int getTotalEstimatedWorkSize()
|
||||||
public synchronized int getTotalEstimatedWorkSize()
|
{
|
||||||
|
return (int) getTotalEstimatedWorkSizeLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public synchronized long getTotalEstimatedWorkSizeLong()
|
||||||
{
|
{
|
||||||
if (maxId == Long.MAX_VALUE)
|
if (maxId == Long.MAX_VALUE)
|
||||||
{
|
{
|
||||||
@@ -405,7 +409,7 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
|
|||||||
logger.debug("\tQ: Work count: " + workCount);
|
logger.debug("\tQ: Work count: " + workCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (int) workCount;
|
return workCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -25,6 +25,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.batch;
|
package org.alfresco.repo.batch;
|
||||||
|
|
||||||
|
import org.alfresco.api.AlfrescoPublicApi;
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
|
import org.alfresco.util.TraceableThreadFactory;
|
||||||
|
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
@@ -43,18 +55,6 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.alfresco.api.AlfrescoPublicApi;
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
|
||||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
|
||||||
import org.alfresco.util.TraceableThreadFactory;
|
|
||||||
import org.alfresco.util.transaction.TransactionListenerAdapter;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <code>BatchProcessor</code> manages the running and monitoring of a potentially long-running transactional batch
|
* A <code>BatchProcessor</code> manages the running and monitoring of a potentially long-running transactional batch
|
||||||
* process. It iterates over a collection, and queues jobs that fire a worker on a batch of members. The queued jobs
|
* process. It iterates over a collection, and queues jobs that fire a worker on a batch of members. The queued jobs
|
||||||
@@ -158,10 +158,17 @@ public class BatchProcessor<T> implements BatchMonitor
|
|||||||
new BatchProcessWorkProvider<T>()
|
new BatchProcessWorkProvider<T>()
|
||||||
{
|
{
|
||||||
boolean hasMore = true;
|
boolean hasMore = true;
|
||||||
public int getTotalEstimatedWorkSize()
|
|
||||||
|
@Override public int getTotalEstimatedWorkSize()
|
||||||
|
{
|
||||||
|
return (int) getTotalEstimatedWorkSizeLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public long getTotalEstimatedWorkSizeLong()
|
||||||
{
|
{
|
||||||
return collection.size();
|
return collection.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<T> getNextWork()
|
public Collection<T> getNextWork()
|
||||||
{
|
{
|
||||||
// Only return the collection once
|
// Only return the collection once
|
||||||
|
Reference in New Issue
Block a user