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

@ManagedResource(description="The management interface for a job") public abstract class AbstractJob extends Object implements Runnable, IJob
  • Field Details

  • Constructor Details

    • AbstractJob

      public AbstractJob()
    • AbstractJob

      public AbstractJob(String jobName, ISymmetricEngine engine, org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler)
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface IJob
    • getTimeBetweenRunsInMs

      protected long getTimeBetweenRunsInMs()
    • stop

      public boolean stop()
      Specified by:
      stop in interface IJob
    • getName

      public String getName()
      Specified by:
      getName in interface IJob
    • getJobDefinition

      public JobDefinition getJobDefinition()
      Specified by:
      getJobDefinition in interface IJob
    • setJobDefinition

      public void setJobDefinition(JobDefinition jobDefinition)
    • invoke

      @ManagedOperation(description="Run this job if it isn\'t already running") public boolean invoke()
    • invoke

      public boolean invoke(boolean force)
      Specified by:
      invoke in interface IJob
    • checkPrerequsites

      protected boolean checkPrerequsites(boolean force)
      Returns:
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • doJob

      protected abstract void doJob(boolean force) throws Exception
      Throws:
      Exception
    • pause

      @ManagedOperation(description="Pause this job") public void pause()
      Specified by:
      pause in interface IJob
    • unpause

      @ManagedOperation(description="Resume the job") public void unpause()
      Specified by:
      unpause in interface IJob
    • setPaused

      public void setPaused(boolean paused)
    • isPaused

      @ManagedAttribute(description="If true, this job has been paused") public boolean isPaused()
      Specified by:
      isPaused in interface IJob
    • isStarted

      @ManagedAttribute(description="If true, this job has been started") public boolean isStarted()
      Specified by:
      isStarted in interface IJob
    • getLastExecutionTimeInMs

      @ManagedMetric(description="The amount of time this job spent in execution during it\'s last run") public long getLastExecutionTimeInMs()
      Specified by:
      getLastExecutionTimeInMs in interface IJob
    • getLastFinishTime

      @ManagedAttribute(description="The last time this job completed execution") public Date getLastFinishTime()
      Specified by:
      getLastFinishTime in interface IJob
    • isRunning

      @ManagedAttribute(description="If true, the job is already running") public boolean isRunning()
      Specified by:
      isRunning in interface IJob
    • 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 interface IJob
    • 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 interface IJob
    • getNextExecutionTime

      public Date getNextExecutionTime()
      Specified by:
      getNextExecutionTime in interface IJob
    • 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 interface IJob
    • isCronSchedule

      public boolean isCronSchedule()
      Specified by:
      isCronSchedule in interface IJob
    • isPeriodicSchedule

      public boolean isPeriodicSchedule()
      Specified by:
      isPeriodicSchedule in interface IJob
    • getSchedule

      public String getSchedule()
      Specified by:
      getSchedule in interface IJob
    • getDefaults

      public abstract JobDefaults getDefaults()
    • getEngine

      public ISymmetricEngine getEngine()
    • getJobName

      public String getJobName()
    • setJobName

      public void setJobName(String jobName)
    • setEngine

      public void setEngine(ISymmetricEngine engine)
    • 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

      public String getTargetNodeId()
    • setTargetNodeId

      public void setTargetNodeId(String targetNodeId)
    • getTargetNodeCount

      public int getTargetNodeCount()
    • setTargetNodeCount

      public void setTargetNodeCount(int targetNodeCount)
    • getDeprecatedStartParameter

      public String getDeprecatedStartParameter()
      Specified by:
      getDeprecatedStartParameter in interface IJob
    • getParameterService

      public IParameterService getParameterService()
    • setParameterService

      public void setParameterService(IParameterService parameterService)
    • setThreadPoolTaskScheduler

      public void setThreadPoolTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler)