Class BackgroundJobService

java.lang.Object
com.atlassian.confluence.impl.backgroundjob.BackgroundJobService

public class BackgroundJobService extends Object
The service that allows to add new background tasks.
Since:
8.1.0
  • Constructor Details

    • BackgroundJobService

      public BackgroundJobService(BackgroundJobDAO backgroundJobDAO, org.springframework.transaction.PlatformTransactionManager transactionManager)
  • Method Details

    • addJob

      public Long addJob(Class<?> processorClass, Map<String,Object> parameters, String description, Instant runAt)
      Adds a new background job.
      Parameters:
      processorClass - processor's class
      parameters - job parameters
      runAt - desired execution time (or Instant.now if it has to be run immediately)
      Returns:
      job id
    • runJobSynchronously

      public void runJobSynchronously(Class<?> processorClass, Map<String,Object> parameters)

      Starts the job synchronously. It uses the same processor used in addJob, calls the job again and again until the job finishes. It is not recommended for production, it should be mostly used in tests.

      No background job records created in the database; it does not support delayed execution.

      Note: the job will be terminated if it takes more than SYNC_EXECUTION_TIMEOUT_SEC

      Parameters:
      processorClass - processor's class
      parameters - job parameters
      Since:
      9.1.0
    • processNextJobs

      @Internal public int processNextJobs()
      Process a next portion of active jobs.
    • registerBackgroundJobProcessor

      public void registerBackgroundJobProcessor(BackgroundJobProcessor backgroundJobProcessor)
      Registers a background processor.
    • unregisterBackgroundJobProcessor

      public void unregisterBackgroundJobProcessor(BackgroundJobProcessor backgroundJobProcessor)
      Unregisters a background processor.
    • convertToJson

      public String convertToJson(Map<String,Object> map)
    • convertToHashMap

      public Map<String,Object> convertToHashMap(String customerInfoJSON)