Class DefaultCronJobService
java.lang.Object
de.hybris.platform.servicelayer.internal.service.AbstractService
de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
de.hybris.platform.servicelayer.cronjob.impl.DefaultCronJobService
- All Implemented Interfaces:
CronJobService,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
Default implementation of the cronjob service.
- Since:
- 4.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intDefault amount ofJobLogModelentries.Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManagerFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanRunOnThisNode(CronJobModel cronJob) getCronJob(String code) Gets the cronjob identified unique by given code.protected StringgetCronJobExpression(CronJobModel cronJob) <C extends CronJobModel,J extends JobModel>
CronJobFactory<C,J> getCronJobFactory(ServicelayerJobModel slayerJobModel) Gets the job identified unique by given code.protected Converter<List<JobLogModel>,String> getLogsAsText(CronJobModel cronJobModel) Returns text representation of top 500CronJobModel.getLogs()entries for a givenCronJobModel, as concatenated and decorated content of itsJobLogModel.getMessage().getLogsAsText(CronJobModel cronJobModel, int count) Returns text representation of top givencountCronJobModel.getLogs()entries for a givenCronJobModel, as concatenated and decorated content of itsJobLogModel.getMessage().JobPerformable<? extends CronJobModel>getPerformable(ServicelayerJobModel slayerJobModel) Returns list ofCronJobModelinstances running on the platform regardless the cluster node.booleanisAbortable(CronJobModel cronJob) Checks if the cronjob model is abortable.booleanisError(CronJobModel cronJob) Checks whether the cronjob was executed not successfully.booleanisFinished(CronJobModel cronJob) Checks whether the cronjob has finished execution and is not running or paused anymore.booleanisPaused(CronJobModel cronJob) Checks whether the cronjob is paused.booleanisPerformable(CronJobModel cronJob) Checks if the cronjob model is performable.booleanisRunning(CronJobModel cronJob) Checks whether the cronjob has not finished or paused execution yet and is still running regardless if has it been restarted or not.booleanisSuccessful(CronJobModel cronJob) Checks whether the cronjob was executed successfully.voidperformCronJob(CronJobModel cronJob) Performs givenCronjobby starting itsJobon the cluster node.voidperformCronJob(CronJobModel cronJob, boolean synchronous) Performs givenCronjobby starting itsJob.voidrequestAbortCronJob(CronJobModel cronJob) voidsetClusterService(ClusterService clusterService) voidsetCronJobCodeGenerator(PersistentKeyGenerator cronJobCodeGenerator) voidsetCronJobDao(CronJobDao cronJobDao) voidvoidsetJobLogConverter(Converter jobLogConverter) voidsetJobLogDao(JobLogDao jobLogDao) voidsetRunCronJobMessageBuilder(RunCronJobMessageCreatorAndSender runCronJobMessageBuilder) Deprecated, for removal: This API element is subject to removal in a future version.since 6.1.0voidsetTaskService(TaskService taskService) voidsetTenantService(TenantService tenantService) Deprecated, for removal: This API element is subject to removal in a future version.since 6.1.0protected voidstartOnDifferentNodeViaTask(CronJobModel cronJob) Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
Field Details
-
DEFAULT_LOG_BUNCH
protected static final int DEFAULT_LOG_BUNCHDefault amount ofJobLogModelentries.- See Also:
-
-
Constructor Details
-
DefaultCronJobService
public DefaultCronJobService()
-
-
Method Details
-
performCronJob
Description copied from interface:CronJobServicePerforms givenCronjobby starting itsJob. If synchronous istrue, theJobwill be performed synchronous, which means that this method will return the control to its caller as recently as thisJobis performed. Synchronous execution is especially useful for short Jobs or testing purpose (JUnit tests for example). If synchronous isfalse, theJobwill be performed asynchronous by executing theJobin a separateThread. This method ignores a nodeIdCronJobModel.getNodeID()and does not start aJobon the cluster node.- Specified by:
performCronJobin interfaceCronJobService- Parameters:
cronJob- which will be usedsynchronous-trueif theJobshould be performed synchronously,falseif theJobshould be performed asynchronously
-
performCronJob
Description copied from interface:CronJobServicePerforms givenCronjobby starting itsJobon the cluster node. The node is given byJobModel.getNodeID(), theJobwill be performed asynchronous, which means that this method will return the control to its caller as recently as thisJobis performed. Call for aCronJobModelwith nodeIdCronJobModel.getNodeID()equal to current nodeIdClusterService.getClusterId()is the same as callCronJobService.performCronJob(CronJobModel, boolean)withsynchronousequal false- Specified by:
performCronJobin interfaceCronJobService- Parameters:
cronJob- which will be used
-
canRunOnThisNode
-
startOnDifferentNodeViaTask
-
getCronJobExpression
-
requestAbortCronJob
Sets theCronJobModel.REQUESTABORTto true for non runningCronJobModel, abortableCronJobModel. Above action is performed ifCronJobModel.getStatus()is in aCronJobStatus.RUNNINGorCronJobStatus.RUNNINGRESTART.- Specified by:
requestAbortCronJobin interfaceCronJobService- Parameters:
cronJob- which will be used- Throws:
IllegalStateException- in case givenCronJobModelis not an abortable.
-
getCronJob
Description copied from interface:CronJobServiceGets the cronjob identified unique by given code.- Specified by:
getCronJobin interfaceCronJobService- Parameters:
code- code for which a cronjob is needed- Returns:
- cronjob identified unique by given code
-
getJob
Description copied from interface:CronJobServiceGets the job identified unique by given code.- Specified by:
getJobin interfaceCronJobService- Parameters:
code- code for which a job is needed- Returns:
- job identified unique by given code
-
isFinished
Description copied from interface:CronJobServiceChecks whether the cronjob has finished execution and is not running or paused anymore.- Specified by:
isFinishedin interfaceCronJobService- Parameters:
cronJob- cronjob to check for- Returns:
- true if cronjob has finished execution
-
isPaused
Description copied from interface:CronJobServiceChecks whether the cronjob is paused.- Specified by:
isPausedin interfaceCronJobService- Parameters:
cronJob- cronjob to check for- Returns:
- true if cronjob is paused
-
isRunning
Description copied from interface:CronJobServiceChecks whether the cronjob has not finished or paused execution yet and is still running regardless if has it been restarted or not.- Specified by:
isRunningin interfaceCronJobService- Parameters:
cronJob- cronjob to check for- Returns:
- true if cronjob is still running
-
isSuccessful
Description copied from interface:CronJobServiceChecks whether the cronjob was executed successfully. Can only be used if cronjob has finished execution (CronJobService.isFinished(CronJobModel)returns true).- Specified by:
isSuccessfulin interfaceCronJobService- Parameters:
cronJob- cronjob to check for- Returns:
- true if cronjob has finished successfully
-
isError
Description copied from interface:CronJobServiceChecks whether the cronjob was executed not successfully. Can only be used if cronjob has finished execution (CronJobService.isFinished(CronJobModel)returns true).- Specified by:
isErrorin interfaceCronJobService- Parameters:
cronJob- cronjob to check for- Returns:
- true if cronjob has finished not successfully
-
getRunningOrRestartedCronJobs
Description copied from interface:CronJobServiceReturns list ofCronJobModelinstances running on the platform regardless the cluster node.- Specified by:
getRunningOrRestartedCronJobsin interfaceCronJobService
-
isPerformable
Description copied from interface:CronJobServiceChecks if the cronjob model is performable.- Specified by:
isPerformablein interfaceCronJobService- Parameters:
cronJob- which will be used
-
isAbortable
Description copied from interface:CronJobServiceChecks if the cronjob model is abortable.- Specified by:
isAbortablein interfaceCronJobService- Parameters:
cronJob- which will be used
-
getPerformable
Description copied from interface:CronJobService- Specified by:
getPerformablein interfaceCronJobService
-
getCronJobFactory
public <C extends CronJobModel,J extends JobModel> CronJobFactory<C,J> getCronJobFactory(ServicelayerJobModel slayerJobModel) Description copied from interface:CronJobService- Specified by:
getCronJobFactoryin interfaceCronJobService
-
getLogsAsText
Description copied from interface:CronJobServiceReturns text representation of top 500CronJobModel.getLogs()entries for a givenCronJobModel, as concatenated and decorated content of itsJobLogModel.getMessage().- Specified by:
getLogsAsTextin interfaceCronJobService
-
getLogsAsText
Description copied from interface:CronJobServiceReturns text representation of top givencountCronJobModel.getLogs()entries for a givenCronJobModel, as concatenated and decorated content of itsJobLogModel.getMessage().- Specified by:
getLogsAsTextin interfaceCronJobService
-
setRunCronJobMessageBuilder
@Deprecated(since="6.1.0", forRemoval=true) public void setRunCronJobMessageBuilder(RunCronJobMessageCreatorAndSender runCronJobMessageBuilder) Deprecated, for removal: This API element is subject to removal in a future version.since 6.1.0 -
setTenantService
@Deprecated(since="6.1.0", forRemoval=true) public void setTenantService(TenantService tenantService) Deprecated, for removal: This API element is subject to removal in a future version.since 6.1.0 -
setClusterService
-
setJobLogConverter
-
getJobLogConverter
-
setCronJobDao
-
setJobDao
-
setJobLogDao
-
setCronJobCodeGenerator
-
setTaskService
-