Package org.duracloud.mill.ltp
Class LoopingTaskProducer<T extends Morsel>
- java.lang.Object
-
- org.duracloud.mill.ltp.LoopingTaskProducer<T>
-
- All Implemented Interfaces:
Runnable
public abstract class LoopingTaskProducer<T extends Morsel> extends Object implements Runnable
This class is responsible for filling the duplicationTaskQueueby looping through all duplication policies for all accounts and spaces and blindly creates duplication tasks. It will create tasks for all items in the the source destination as well as all items in the destination provider but not in the source provider. A notable feature of this task producer is that it attempts to respect a designated maximum task queue size. Once the limit has been reached, the producer will stop. On subsequent runs, the producer will pick up where it left off, starting with the next account,space,set of content items, and duplication store policy. If all content items are visited within a single run before the task queue limit has been reached, the producer will exit. For more information about how this process fits into the whole system of collaborating components, see https://wiki.duraspace.org/display/DSPINT/DuraCloud+Duplication+-+System+Overview- Author:
- Daniel Bernstein Date: Nov 5, 2013
-
-
Constructor Summary
Constructors Constructor Description LoopingTaskProducer(CredentialsRepo credentialsRepo, StorageProviderFactory storageProviderFactory, org.duracloud.common.queue.TaskQueue taskQueue, StateManager<T> state, int maxTaskQueueSize, Frequency frequency, LocalTime startTime, NotificationManager notificationManager, LoopingTaskProducerConfigurationManager config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddToReloadList(T morsel)protected RunStatscalculateStatTotals(RunStats currentTotals)protected Queue<T>createQueue()protected abstract RunStatscreateRunStats()protected CredentialsRepogetCredentialsRepo()protected FrequencygetFrequency()protected abstract StringgetLoopingProducerTypePrefix()A short looping producer type identifier for use with state files.protected intgetMaxTaskQueueSize()protected RunStatsgetStats(String account)protected org.duracloud.storage.provider.StorageProvidergetStorageProvider(String account, String storeId)protected org.duracloud.storage.provider.StorageProvidergetStorageProvider(StorageProviderCredentials creds)protected org.duracloud.common.queue.TaskQueuegetTaskQueue()protected abstract voidloadMorselQueueFromSource(Queue<T> morselQueue)protected abstract voidlogCumulativeSessionStats(Map<String,RunStats> runstats, RunStats cumulativeTotals)protected abstract voidlogGlobalncrementalStats(RunStats incrementalTotals)protected abstract voidlogIncrementalStatsByAccount(String account, RunStats stats)protected abstract voidnibble(Queue<T> queue)voidrun()protected voidsendEmail(String message, Exception ex)protected voidsendEmail(String subject, String body)
-
-
-
Constructor Detail
-
LoopingTaskProducer
public LoopingTaskProducer(CredentialsRepo credentialsRepo, StorageProviderFactory storageProviderFactory, org.duracloud.common.queue.TaskQueue taskQueue, StateManager<T> state, int maxTaskQueueSize, Frequency frequency, LocalTime startTime, NotificationManager notificationManager, LoopingTaskProducerConfigurationManager config)
-
-
Method Detail
-
getFrequency
protected Frequency getFrequency()
-
getCredentialsRepo
protected CredentialsRepo getCredentialsRepo()
-
getTaskQueue
protected org.duracloud.common.queue.TaskQueue getTaskQueue()
-
getMaxTaskQueueSize
protected int getMaxTaskQueueSize()
-
addToReloadList
protected void addToReloadList(T morsel)
- Parameters:
morsel-
-
getStorageProvider
protected org.duracloud.storage.provider.StorageProvider getStorageProvider(String account, String storeId)
-
getStorageProvider
protected org.duracloud.storage.provider.StorageProvider getStorageProvider(StorageProviderCredentials creds)
- Parameters:
creds-- Returns:
-
loadMorselQueueFromSource
protected abstract void loadMorselQueueFromSource(Queue<T> morselQueue)
- Parameters:
morselQueue-
-
createRunStats
protected abstract RunStats createRunStats()
- Returns:
-
logGlobalncrementalStats
protected abstract void logGlobalncrementalStats(RunStats incrementalTotals)
- Parameters:
incrementalTotals-
-
logIncrementalStatsByAccount
protected abstract void logIncrementalStatsByAccount(String account, RunStats stats)
- Parameters:
account-stats-
-
logCumulativeSessionStats
protected abstract void logCumulativeSessionStats(Map<String,RunStats> runstats, RunStats cumulativeTotals)
- Parameters:
runstats-cumulativeTotals-
-
getLoopingProducerTypePrefix
protected abstract String getLoopingProducerTypePrefix()
A short looping producer type identifier for use with state files.- Returns:
-
-