Package org.cyclos.impl.utils.tasks
Class SimplePollingTask
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.utils.tasks.AbstractTask
-
- org.cyclos.impl.utils.tasks.AbstractPollingTask
-
- org.cyclos.impl.utils.tasks.SimplePollingTask
-
- All Implemented Interfaces:
Runnable,PollingTask
- Direct Known Subclasses:
AccountVerificationPollingTask,AddressLocatingPollingTask,ArchiveImportsPollingTask,DispatchArchiveAccountFeesPollingTask,InstanceUpdatePollingTask,PurgeDeviceActivationsPollingTask,PurgeDeviceConfirmationsPollingTask,PurgeExpiredPinsPollingTask,PurgeExpiredScriptStoragesPollingTask,PurgeExternalOperationExecutionsPollingTask,PurgeFailedPasswordLogsPollingTask,PurgeFailedPrincipalLogsPollingTask,PurgeFcmTokensPollingTask,PurgeForgotPasswordRequestLogsPollingTask,PurgeInviteTokensPollingTask,PurgeMessagesOnTrashPollingTask,PurgeOidcAuthorizationsPollingTask,PurgeOidcTokensPollingTask,PurgeOldErrorLogsPollingTask,PurgeOldNotificationsPollingTask,PurgeOrphanDataTranslationsPollingTask,PurgeRemoteAddressBlocksPollingTask,PurgeSessionsPollingTask,PurgeTempFilesPollingTask,PurgeWizardExecutionsPollingTask,RunScheduledPollingTask,ScheduledAccountFeesPollingTask,TokensPollingTask
public abstract class SimplePollingTask extends AbstractPollingTask
APollingTaskwhich runs a method
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.utils.tasks.AbstractTask
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 SimplePollingTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoRun()Invokesexecute()as system and within a new transactionprotected abstract longexecute()Executes the task batch.protected booleanisRunInTransaction()Return whether the execute method must be ran in a transaction or not.-
Methods inherited from class org.cyclos.impl.utils.tasks.AbstractPollingTask
dateFromDelay, getFirstExecution, getInitialSleepSeconds, getNextExecution, getSecondsUntilNextDay, getSecondsUntilNextHour, getSleepSeconds, getStorage, initialize, isExclusiveInCluster, run
-
Methods inherited from class org.cyclos.impl.utils.tasks.AbstractTask
getLogConfiguration, getName, logName, logTaskError, logTaskSuccess, shouldGenerateErrorLog, toString
-
Methods inherited from class org.cyclos.impl.AbstractGlobalServerComponent
getBaseEntityManagerHandler, getEntityManager
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, 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.impl.utils.tasks.PollingTask
getName
-
-
-
-
Method Detail
-
doRun
protected final void doRun()
Invokesexecute()as system and within a new transaction- Specified by:
doRunin classAbstractPollingTask
-
execute
protected abstract long execute() throws ThrowableExecutes the task batch. This method must be idempotent, which means that subsequent invocations should not cause side effects. For example, a task could expire data up to the current hour. If executed several times within any given hour, only the first execution should change data, while others should not affect anything. Should return the number of affected records- Throws:
Throwable
-
isRunInTransaction
protected boolean isRunInTransaction()
Return whether the execute method must be ran in a transaction or not. By default a transaction is opened before execute the method.
-
-