Package org.jumpmind.symmetric.job
Class AbstractJob
java.lang.Object
org.jumpmind.symmetric.job.AbstractJob
- All Implemented Interfaces:
Runnable
,IExtensionPoint
,IJob
- Direct Known Subclasses:
BshJob
,FileSyncPullJob
,FileSyncPushJob
,FileSyncTrackerJob
,HeartbeatJob
,IncomingPurgeJob
,InitialLoadExtractorJob
,InitialLoadJob
,JavaJob
,LogMinerJob
,OfflinePullJob
,OfflinePushJob
,OutgoingPurgeJob
,PullJob
,PushJob
,RefreshCacheJob
,ReportStatusJob
,RouterJob
,SqlJob
,StageManagementJob
,StatisticFlushJob
,SyncConfigJob
,SyncTriggersJob
,WatchdogJob
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ISymmetricEngine
protected String
protected org.slf4j.Logger
protected IParameterService
protected RandomTimeSlot
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractJob
(String jobName, ISymmetricEngine engine, org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkPrerequsites
(boolean force) protected abstract void
doJob
(boolean force) long
abstract JobDefaults
long
getName()
long
long
int
org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
protected long
long
boolean
invoke()
boolean
invoke
(boolean force) boolean
boolean
isPaused()
boolean
boolean
boolean
void
pause()
void
run()
void
setEngine
(ISymmetricEngine engine) void
setJobDefinition
(JobDefinition jobDefinition) void
setJobName
(String jobName) void
setParameterService
(IParameterService parameterService) void
setPaused
(boolean paused) void
setProcessedCount
(long processedCount) void
setTargetNodeCount
(int targetNodeCount) void
setTargetNodeId
(String targetNodeId) void
setTaskScheduler
(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler) void
setThreadPoolTaskScheduler
(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler) void
start()
boolean
stop()
void
unpause()
-
Field Details
-
log
protected org.slf4j.Logger log -
jobName
-
engine
-
randomTimeSlot
-
parameterService
-
-
Constructor Details
-
AbstractJob
public AbstractJob() -
AbstractJob
public AbstractJob(String jobName, ISymmetricEngine engine, org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler)
-
-
Method Details
-
start
public void start() -
getTimeBetweenRunsInMs
protected long getTimeBetweenRunsInMs() -
stop
public boolean stop() -
getName
-
getJobDefinition
- Specified by:
getJobDefinition
in interfaceIJob
-
setJobDefinition
-
invoke
@ManagedOperation(description="Run this job if it isn\'t already running") public boolean invoke() -
invoke
public boolean invoke(boolean force) -
checkPrerequsites
protected boolean checkPrerequsites(boolean force) - Returns:
-
run
public void run() -
doJob
- Throws:
Exception
-
pause
@ManagedOperation(description="Pause this job") public void pause() -
unpause
@ManagedOperation(description="Resume the job") public void unpause() -
setPaused
public void setPaused(boolean paused) -
isPaused
@ManagedAttribute(description="If true, this job has been paused") public boolean isPaused() -
isStarted
@ManagedAttribute(description="If true, this job has been started") public boolean isStarted() -
getLastExecutionTimeInMs
@ManagedMetric(description="The amount of time this job spent in execution during it\'s last run") public long getLastExecutionTimeInMs()- Specified by:
getLastExecutionTimeInMs
in interfaceIJob
-
getLastFinishTime
@ManagedAttribute(description="The last time this job completed execution") public Date getLastFinishTime()- Specified by:
getLastFinishTime
in interfaceIJob
-
isRunning
@ManagedAttribute(description="If true, the job is already running") public boolean isRunning() -
getNumberOfRuns
@ManagedMetric(description="The number of times this job has been run during the lifetime of the JVM") public long getNumberOfRuns()- Specified by:
getNumberOfRuns
in interfaceIJob
-
getTotalExecutionTimeInMs
@ManagedMetric(description="The total amount of time this job has spent in execution during the lifetime of the JVM") public long getTotalExecutionTimeInMs()- Specified by:
getTotalExecutionTimeInMs
in interfaceIJob
-
getNextExecutionTime
- Specified by:
getNextExecutionTime
in interfaceIJob
-
getAverageExecutionTimeInMs
@ManagedMetric(description="The total amount of time this job has spend in execution during the lifetime of the JVM") public long getAverageExecutionTimeInMs()- Specified by:
getAverageExecutionTimeInMs
in interfaceIJob
-
isCronSchedule
public boolean isCronSchedule()- Specified by:
isCronSchedule
in interfaceIJob
-
isPeriodicSchedule
public boolean isPeriodicSchedule()- Specified by:
isPeriodicSchedule
in interfaceIJob
-
getSchedule
- Specified by:
getSchedule
in interfaceIJob
-
getDefaults
-
getEngine
-
getJobName
-
setJobName
-
setEngine
-
getTaskScheduler
public org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler getTaskScheduler() -
setTaskScheduler
public void setTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler) -
getProcessedCount
public long getProcessedCount() -
setProcessedCount
public void setProcessedCount(long processedCount) -
getTargetNodeId
-
setTargetNodeId
-
getTargetNodeCount
public int getTargetNodeCount() -
setTargetNodeCount
public void setTargetNodeCount(int targetNodeCount) -
getDeprecatedStartParameter
- Specified by:
getDeprecatedStartParameter
in interfaceIJob
-
getParameterService
-
setParameterService
-
setThreadPoolTaskScheduler
public void setThreadPoolTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler)
-