Package org.cyclos.impl.utils.tasks
Class AbstractBackgroundTask
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.utils.tasks.AbstractTask
-
- org.cyclos.impl.utils.tasks.AbstractBackgroundTask
-
- All Implemented Interfaces:
BackgroundTask,HasMessageKey
- Direct Known Subclasses:
AdInterestNotificationBackgroundTask,ArchiveAccountFeeLogBackgroundTask,ArchiveBulkActionBackgroundTask,BulkActionProcessingBackgroundTask,ChargeAccountFeeBatchBackgroundTask,DispatchAccountFeeChargesBackgroundTask,EntityNotificationProcessingBackgroundTask,ExternalPaymentBackgroundTask,ImportBackgroundTask,IndexEntitiesBackgroundTask,InlineScriptBackgroundTask,MailProcessingBackgroundTask,MessageProcessingBackgroundTask,NotificationSendingBackgroundTask,ResetRatesBackgroundTask,RunScheduledBackgroundTask
public abstract class AbstractBackgroundTask extends AbstractTask implements BackgroundTask
Abstract implementation forBackgroundTask
-
-
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 AbstractBackgroundTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract longdoExecute(String context)Must be implemented to actually execute the task logic, returning the number of affected recordsvoidexecute(String display, String context)Executes the background task with the given context.protected booleanisVerbose()protected StringlogName(String display)protected <T> TrunInEntityNetwork(SimpleEntity entity, Supplier<T> action)Runs the given runnable in the entity's network, if any.protected <T> TrunInNetwork(Network network, Supplier<T> action)Runs the runnable in the given network.-
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, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.utils.tasks.BackgroundTask
getName
-
Methods inherited from interface org.cyclos.utils.HasMessageKey
getMessageKey
-
-
-
-
Method Detail
-
execute
public final void execute(String display, String context)
Description copied from interface:BackgroundTaskExecutes the background task with the given context. The given display name is used on logs.- Specified by:
executein interfaceBackgroundTask
-
doExecute
protected abstract long doExecute(String context)
Must be implemented to actually execute the task logic, returning the number of affected records
-
isVerbose
protected boolean isVerbose()
- Specified by:
isVerbosein classAbstractTask
-
logName
protected String logName(String display)
- Specified by:
logNamein classAbstractTask
-
runInEntityNetwork
protected <T> T runInEntityNetwork(SimpleEntity entity, Supplier<T> action)
Runs the given runnable in the entity's network, if any. Otherwise runs directly.
-
-