Interface StructureJob
- All Known Implementing Classes:
AbstractStructureJob,SystemStructureJob
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 ClassesModifier and TypeInterfaceDescriptionstatic enumSimple enumeration of the possible job states -
Method Summary
Modifier and TypeMethodDescriptiongetState()ApplicationUsergetUser()voidjob()Runs the job in background.voidreset()Reset the state of the job so that it becomesStructureJob.State.PENDING.
-
Method Details
-
job
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
-