Interface StructureJob

All Known Implementing Classes:
AbstractStructureJob, SystemStructureJob

public interface StructureJob

StructureJob is a single one-time or repetitive background task, run by the StructureJobManager.

The interface defines the main job() method that does the work and a few other methods to provide the lifecycle information for the job manager.

Typically you should extend AbstractStructureJob to have housekeeping done for you.

All methods of this interface must be implemented in a thread-safe way, because typically maintenance and running the job happen in different threads. However, the implementation may be certain the job() method (or AbstractStructureJob.doJob() method) will never be called concurrently in different threads.

Author:
Igor Sereda
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Simple enumeration of the possible job states
  • Method Summary

    Modifier and Type
    Method
    Description
     
    ApplicationUser
     
    void
    job()
    Runs the job in background.
    void
    Reset the state of the job so that it becomes StructureJob.State.PENDING.
  • Method Details

    • job

      void job() throws Exception

      Runs the job in background. Before this method is called, all JIRA thread maintenance is done and the current user is set up to be what getUser() returns.

      Throws:
      Exception - any exception thrown by the job will be logged but won't stop job manager
    • reset

      void reset()

      Reset the state of the job so that it becomes StructureJob.State.PENDING. Should not be called when the job is running.

    • getState

      StructureJob.State getState()
      Returns:
      the current state of the job
      See Also:
    • getUser

      ApplicationUser getUser()
      Returns:
      the JIRA user account, under which the job must run, null means anonymous