Class SpaceDeletionBackgroundJobProcessor
java.lang.Object
com.atlassian.confluence.impl.space.deletion.backgrounddeletion.SpaceDeletionBackgroundJobProcessor
- All Implemented Interfaces:
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.
- Since:
- 9.1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpaceDeletionBackgroundJobProcessor
(BackgroundJobService backgroundJobService, SpaceContentErasersListBuilder spaceContentErasersListBuilder, ConfluenceUserDao confluenceUserDao, SpaceDaoInternal spaceDao, ExportableEntityInfoFactory exportableEntityInfoFactory, org.hibernate.SessionFactory sessionFactory, AccessModeService accessModeService, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
performSpaceDeletionSynchronously
(long spaceId) Performs space deletion asynchronously.Main method responsible for the space data deletion and sending corresponding events.startSpaceDeletionInBackground
(long spaceId) Creates a new background job for space removal and starts it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.confluence.impl.backgroundjob.BackgroundJobProcessor
isSingleton
-
Field Details
-
SPACE_DELETION_SCHEDULE_NEXT_RUN_IN_MINUTES
- See Also:
-
SPACE_ID_PARAMETER_NAME
- See Also:
-
SPACE_DELETION_INITIATOR_USER
- See Also:
-
SPACE_DELETION_RUN_NUMBER
- See Also:
-
-
Constructor Details
-
SpaceDeletionBackgroundJobProcessor
public SpaceDeletionBackgroundJobProcessor(BackgroundJobService backgroundJobService, SpaceContentErasersListBuilder spaceContentErasersListBuilder, ConfluenceUserDao confluenceUserDao, SpaceDaoInternal spaceDao, ExportableEntityInfoFactory exportableEntityInfoFactory, org.hibernate.SessionFactory sessionFactory, AccessModeService accessModeService, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
startSpaceDeletionInBackground
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 interfaceBackgroundJobProcessor
- Parameters:
jobId
- background job idcurrentJobState
- 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
-