Package org.cyclos.impl.utils.tasks
Class AbstractPollingTask
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.utils.tasks.AbstractTask
-
- org.cyclos.impl.utils.tasks.AbstractPollingTask
-
- All Implemented Interfaces:
Runnable,PollingTask,HasMessageKey
- Direct Known Subclasses:
BackgroundTaskExecutionPollingTask,EntityBatchPollingTask,SimplePollingTask
public abstract class AbstractPollingTask extends AbstractTask implements PollingTask
Base class for tasks which keeps looking for available data to be processed. When running in a cluster, it is guaranteed that only a single node runs the same polling task at the same time.
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.utils.tasks.AbstractTask
clusterHandler, errorLogService, invokerHandler, loggingHandler
-
Fields inherited from class org.cyclos.impl.AbstractGlobalServerComponent
rawEntityManagerHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description AbstractPollingTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoRun()Subclasses must implement this method to do the task.PollingTaskFirstExecutiongetFirstExecution()Returns the polling task first executionPollingTaskRecurrencegetRecurrence()Return the polling task recurrenceprotected EntityBackedParameterStoragegetStorage()Returns a storage that subclasses may use to store data between executionsprotected booleanisVerbose()protected StringlogName(String display)voidrun()StringtoString()-
Methods inherited from class org.cyclos.impl.utils.tasks.AbstractTask
getLogConfiguration, getName, logTaskError, logTaskSuccess, resolveName, shouldGenerateErrorLog
-
Methods inherited from class org.cyclos.impl.AbstractGlobalServerComponent
getBaseEntityManagerHandler, getEntityManager
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.cyclos.utils.HasMessageKey
getMessageKey
-
Methods inherited from interface org.cyclos.impl.utils.tasks.PollingTask
getName
-
-
-
-
Method Detail
-
getFirstExecution
public PollingTaskFirstExecution getFirstExecution()
Description copied from interface:PollingTaskReturns the polling task first execution- Specified by:
getFirstExecutionin interfacePollingTask
-
getRecurrence
public PollingTaskRecurrence getRecurrence()
Description copied from interface:PollingTaskReturn the polling task recurrence- Specified by:
getRecurrencein interfacePollingTask
-
doRun
protected abstract void doRun()
Subclasses must implement this method to do the task.
-
getStorage
protected EntityBackedParameterStorage getStorage()
Returns a storage that subclasses may use to store data between executions
-
isVerbose
protected boolean isVerbose()
- Specified by:
isVerbosein classAbstractTask
-
logName
protected String logName(String display)
- Specified by:
logNamein classAbstractTask
-
-