Class JobHelper

java.lang.Object
org.codelibs.fess.helper.JobHelper

public class JobHelper extends Object
Helper class for managing scheduled jobs within the Fess system. This class provides functionality for registering, unregistering, and monitoring scheduled jobs.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected ThreadLocal<org.lastaflute.job.LaJobRuntime>
    Thread-local storage for job runtime information
    protected int
    Monitor interval in seconds (default: 1 hour)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.lastaflute.job.LaJobRuntime
    Gets the job runtime for the current thread.
    boolean
    Checks if a job with the specified ID is available.
    void
    register(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
    Registers a scheduled job with the job manager.
    void
    register(org.lastaflute.job.LaCron cron, org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
    Registers a scheduled job with the specified cron scheduler.
    void
    remove(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
    Removes a scheduled job completely from the job manager.
    void
    setJobRuntime(org.lastaflute.job.LaJobRuntime runtime)
    Sets the job runtime for the current thread.
    void
    setMonitorInterval(int monitorInterval)
    Sets the monitor interval for job monitoring.
    org.codelibs.core.timer.TimeoutTask
    startMonitorTask(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog)
    Starts a monitor task for tracking job execution.
    void
    store(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog)
    Stores a job log entry in the database.
    void
    unregister(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
    Unregisters a scheduled job from the job manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • monitorInterval

      protected int monitorInterval
      Monitor interval in seconds (default: 1 hour)
    • jobRuntimeLocal

      protected ThreadLocal<org.lastaflute.job.LaJobRuntime> jobRuntimeLocal
      Thread-local storage for job runtime information
  • Constructor Details

    • JobHelper

      public JobHelper()
      Default constructor.
  • Method Details

    • register

      public void register(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
      Registers a scheduled job with the job manager.
      Parameters:
      scheduledJob - the scheduled job to register
    • register

      public void register(org.lastaflute.job.LaCron cron, org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
      Registers a scheduled job with the specified cron scheduler.
      Parameters:
      cron - the cron scheduler to use
      scheduledJob - the scheduled job to register
    • unregister

      public void unregister(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
      Unregisters a scheduled job from the job manager.
      Parameters:
      scheduledJob - the scheduled job to unregister
      Throws:
      ScheduledJobException - if the job cannot be unregistered
    • remove

      public void remove(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob)
      Removes a scheduled job completely from the job manager.
      Parameters:
      scheduledJob - the scheduled job to remove
      Throws:
      ScheduledJobException - if the job cannot be removed
    • isAvailable

      public boolean isAvailable(String id)
      Checks if a job with the specified ID is available.
      Parameters:
      id - the job ID to check
      Returns:
      true if the job is available, false otherwise
    • store

      public void store(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog)
      Stores a job log entry in the database.
      Parameters:
      jobLog - the job log entry to store
    • startMonitorTask

      public org.codelibs.core.timer.TimeoutTask startMonitorTask(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog)
      Starts a monitor task for tracking job execution.
      Parameters:
      jobLog - the job log to monitor
      Returns:
      the timeout task for monitoring
    • setMonitorInterval

      public void setMonitorInterval(int monitorInterval)
      Sets the monitor interval for job monitoring.
      Parameters:
      monitorInterval - the monitor interval in seconds
    • setJobRuntime

      public void setJobRuntime(org.lastaflute.job.LaJobRuntime runtime)
      Sets the job runtime for the current thread.
      Parameters:
      runtime - the job runtime to set
    • getJobRuntime

      public org.lastaflute.job.LaJobRuntime getJobRuntime()
      Gets the job runtime for the current thread.
      Returns:
      the job runtime for the current thread