Package org.cyclos.impl.utils.tasks
Class PollingTaskHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.BaseGlobalHandlerImpl
-
- org.cyclos.impl.utils.tasks.PollingTaskHandlerImpl
-
- All Implemented Interfaces:
ApplicationInitializationListener,PollingTaskHandler,PollingTaskHandlerImplementor
@Component public class PollingTaskHandlerImpl extends BaseGlobalHandlerImpl implements PollingTaskHandlerImplementor, ApplicationInitializationListener
Implementation forPollingTaskHandler
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractGlobalServerComponent
rawEntityManagerHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.impl.ApplicationInitializationListener
MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description PollingTaskHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawakeNow(PollingTask pollingTask)Awakes the givenPollingTask's thread now.voidcancelTasks()Cancels schedulings for allPollingTasks<T extends PollingTask>
TgetTask(Class<T> pollingTaskType)Returns aPollingTaskHandlerby classvoidonApplicationInitialization()Invoked when the application service is initializedvoidonTaskFinished(PollingTask pollingTask)Indicates that the task has finished executingvoidonTaskStarted(PollingTask pollingTask)Indicates that the task has started executingvoidreschedule(Class<? extends PollingTask> pollingTaskType, Date nextExecution)Reschedules the givenPollingTaskto run after the givenDatevoidscheduleAwake(Class<? extends PollingTask> pollingTaskType)Schedules an awake for thePollingTaskof the given type after the current invocation endsvoidscheduleTasks()Schedules allPollingTaskexecutions (if not already started)-
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, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.ApplicationInitializationListener
applicationInitializationPriority, getInitializationId
-
-
-
-
Method Detail
-
awakeNow
public void awakeNow(PollingTask pollingTask)
Description copied from interface:PollingTaskHandlerImplementorAwakes the givenPollingTask's thread now. Not intended to be used by business services, as invoking it within a DB transaction would probably result in data to be processed not yet visible to thePollingTask, which runs in a separated DB transaction.- Specified by:
awakeNowin interfacePollingTaskHandlerImplementor
-
cancelTasks
public void cancelTasks()
Description copied from interface:PollingTaskHandlerImplementorCancels schedulings for allPollingTasks- Specified by:
cancelTasksin interfacePollingTaskHandlerImplementor
-
getTask
public <T extends PollingTask> T getTask(Class<T> pollingTaskType)
Description copied from interface:PollingTaskHandlerImplementorReturns aPollingTaskHandlerby class- Specified by:
getTaskin interfacePollingTaskHandlerImplementor
-
onApplicationInitialization
public void onApplicationInitialization()
Description copied from interface:ApplicationInitializationListenerInvoked when the application service is initialized- Specified by:
onApplicationInitializationin interfaceApplicationInitializationListener
-
onTaskFinished
public void onTaskFinished(PollingTask pollingTask)
Description copied from interface:PollingTaskHandlerImplementorIndicates that the task has finished executing- Specified by:
onTaskFinishedin interfacePollingTaskHandlerImplementor
-
onTaskStarted
public void onTaskStarted(PollingTask pollingTask)
Description copied from interface:PollingTaskHandlerImplementorIndicates that the task has started executing- Specified by:
onTaskStartedin interfacePollingTaskHandlerImplementor
-
reschedule
public void reschedule(Class<? extends PollingTask> pollingTaskType, Date nextExecution)
Description copied from interface:PollingTaskHandlerImplementorReschedules the givenPollingTaskto run after the givenDate- Specified by:
reschedulein interfacePollingTaskHandlerImplementor
-
scheduleAwake
public void scheduleAwake(Class<? extends PollingTask> pollingTaskType)
Description copied from interface:PollingTaskHandlerSchedules an awake for thePollingTaskof the given type after the current invocation ends- Specified by:
scheduleAwakein interfacePollingTaskHandler
-
scheduleTasks
public void scheduleTasks()
Description copied from interface:PollingTaskHandlerImplementorSchedules allPollingTaskexecutions (if not already started)- Specified by:
scheduleTasksin interfacePollingTaskHandlerImplementor
-
-