Package org.cyclos.impl.utils.tasks
Class BackgroundTaskHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.BaseGlobalHandlerImpl
-
- org.cyclos.impl.utils.tasks.BackgroundTaskHandlerImpl
-
- All Implemented Interfaces:
ApplicationInitializationListener,BaseApplicationInitializationListener,BackgroundTaskHandler,BackgroundTaskHandlerImplementor
@Component public class BackgroundTaskHandlerImpl extends BaseGlobalHandlerImpl implements BackgroundTaskHandlerImplementor, ApplicationInitializationListener
Implementation forBackgroundTaskHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBackgroundTaskHandlerImpl.TaskAccessor
-
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.BaseApplicationInitializationListener
MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description BackgroundTaskHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CustomBackgroundTaskSchedulingcustom(String internalName, String context)Returns a newCustomBackgroundTaskSchedulingwhich is used to schedule a custom background taskvoidexecute(BackgroundTaskExecutionContext context)Executes the task nowSet<RunningTaskDescriptor>getRunningTasks()Returns an unmodifiable view of the background tasks that are currently running.voidinitialize()booleanisScheduledOrRunning(Class<? extends BackgroundTask> type, Object context)Returns whether the given background task type, with the given context, is either scheduled for execution or currently runningvoidonApplicationInitialization()Invoked when the application service is initializedvoidschedule(BackgroundTaskScheduling task)Schedule aBackgroundTaskto run-
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.BaseApplicationInitializationListener
applicationInitializationPriority, getInitializationId
-
-
-
-
Method Detail
-
custom
public CustomBackgroundTaskScheduling custom(String internalName, String context)
Description copied from interface:BackgroundTaskHandlerReturns a newCustomBackgroundTaskSchedulingwhich is used to schedule a custom background task- Specified by:
customin interfaceBackgroundTaskHandler
-
execute
public void execute(BackgroundTaskExecutionContext context)
Description copied from interface:BackgroundTaskHandlerImplementorExecutes the task now- Specified by:
executein interfaceBackgroundTaskHandlerImplementor
-
getRunningTasks
public Set<RunningTaskDescriptor> getRunningTasks()
Description copied from interface:BackgroundTaskHandlerImplementorReturns an unmodifiable view of the background tasks that are currently running.- Specified by:
getRunningTasksin interfaceBackgroundTaskHandlerImplementor
-
initialize
@PostConstruct public void initialize()
-
isScheduledOrRunning
public boolean isScheduledOrRunning(Class<? extends BackgroundTask> type, Object context)
Description copied from interface:BackgroundTaskHandlerReturns whether the given background task type, with the given context, is either scheduled for execution or currently running- Specified by:
isScheduledOrRunningin interfaceBackgroundTaskHandler
-
onApplicationInitialization
public void onApplicationInitialization()
Description copied from interface:ApplicationInitializationListenerInvoked when the application service is initialized- Specified by:
onApplicationInitializationin interfaceApplicationInitializationListener
-
schedule
public void schedule(BackgroundTaskScheduling task)
Description copied from interface:BackgroundTaskHandlerSchedule aBackgroundTaskto run- Specified by:
schedulein interfaceBackgroundTaskHandler
-
-