Class SpaceDeletionBackgroundJobProcessor

java.lang.Object
com.atlassian.confluence.impl.space.deletion.backgrounddeletion.SpaceDeletionBackgroundJobProcessor
All Implemented Interfaces:
BackgroundJobProcessor

public class SpaceDeletionBackgroundJobProcessor extends Object implements BackgroundJobProcessor

Can remove space content via a set of small iterations (each in its own transaction). One transaction should not take more than a minute or another timeout provided by backgroundJobService.

It can work in two modes:

  • Async (typical scenario). A background job is created which performs space deletion as a set of transactions in background.
  • Sync mode (used for tests). No background processing, all transactions are run one by one until everything is done.
It can work in two sync mode (transactions are run one by one) or in async mode (a background job will be created).

Since:
9.1.0
  • Field Details

  • Constructor Details

  • Method Details

    • startSpaceDeletionInBackground

      public Long startSpaceDeletionInBackground(long spaceId)
      Creates a new background job for space removal and starts it. This function is very quick because it creates a background job only.
      Parameters:
      spaceId - space id
      Returns:
      job id
    • performSpaceDeletionSynchronously

      public void performSpaceDeletionSynchronously(long spaceId)
      Performs space deletion asynchronously. Not for production. Should be used in tests and in tearing down data after tests.
      Parameters:
      spaceId - space id
    • process

      public BackgroundJobResponse process(Long jobId, Map<String,Object> currentJobState, long processingTimeout)
      Main method responsible for the space data deletion and sending corresponding events. Every time it is called, it deletes data until the deadline is reached. If the deadline has reached, its current state will be persisted and provided next time (see currentJobState). Next time, it will receive that object back as a parameter so it will be able to resume the deletion process properly. It will be called again and again until the deletion processed is not completely finished.
      Specified by:
      process in interface BackgroundJobProcessor
      Parameters:
      jobId - background job id
      currentJobState - parameters saved from the previous execution (standard behaviour of the background jobs).
      processingTimeout - timeout for the processing. This method should stop processing after the timeout, return the current state and exit.
      Returns:
      response