Class DefaultReIndexJobManager
- java.lang.Object
-
- com.atlassian.confluence.internal.index.status.DefaultReIndexJobManager
-
- All Implemented Interfaces:
ReIndexJobManager,ReIndexJobManagerInternal
public class DefaultReIndexJobManager extends Object implements ReIndexJobManagerInternal
This implementation ofReIndexJobManagerlistens to indexing-related events and update re-index status accordingly- Since:
- 7.6.0
-
-
Field Summary
-
Fields inherited from interface com.atlassian.confluence.internal.index.status.ReIndexJobManagerInternal
REINDEX_IMPROVEMENT_DARKFEATURE_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultReIndexJobManager(ReIndexJobPersister persister, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.scheduler.SchedulerService schedulerService, ClusterManager clusterManager, com.atlassian.beehive.ClusterLockService clusterLockService, com.atlassian.sal.api.features.DarkFeatureManager darkFeatureManager, BootstrapManager bootstrapManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacknowledgeRunningJob()Mark most recent or running re-index job as acknowledged.voidclear()Delete most recent or running re-index job.Optional<ReIndexJob>getRunningOrMostRecentReIndex()voidonIndexRebuildFinished(ReindexFinishedEvent ignored)voidonIndexRebuildStarted(ReindexStartedEvent startedEvent)voidonIndexSnapshotCreationFailedEvent(IndexSnapshotCreationFailedEvent failedEvent)voidonIndexSnapshotRestorationFailedEvent(IndexSnapshotRestorationFailedEvent failedEvent)voidonIndexSnapshotRestoredSuccessfullyEvent(IndexSnapshotRestoredSuccessfullyEvent ignored)voidonRestoreIndexSnapshotStartedEvent(RestoreIndexSnapshotStartedEvent ignored)voidregister()voidunregister()voidupdateReIndexJobIfPresent(Consumer<ReIndexJob> updater)Try to update running re-index job in an atomic operation, synchronised by a cluster-wide lock.
-
-
-
Constructor Detail
-
DefaultReIndexJobManager
public DefaultReIndexJobManager(ReIndexJobPersister persister, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.scheduler.SchedulerService schedulerService, ClusterManager clusterManager, com.atlassian.beehive.ClusterLockService clusterLockService, com.atlassian.sal.api.features.DarkFeatureManager darkFeatureManager, BootstrapManager bootstrapManager)
-
-
Method Detail
-
register
@PostConstruct public void register()
-
unregister
@PreDestroy public void unregister()
-
getRunningOrMostRecentReIndex
public Optional<ReIndexJob> getRunningOrMostRecentReIndex()
- Specified by:
getRunningOrMostRecentReIndexin interfaceReIndexJobManager- Returns:
- most recent or running re-index job. Empty if there is neither.
-
acknowledgeRunningJob
public boolean acknowledgeRunningJob() throws InterruptedExceptionDescription copied from interface:ReIndexJobManagerMark most recent or running re-index job as acknowledged. No-op if there is neither.- Specified by:
acknowledgeRunningJobin interfaceReIndexJobManager- Returns:
- true if most recent/running re-index job has been successfully marked as acknowledged.
- Throws:
InterruptedException- if interrupted when trying to ack the job
-
updateReIndexJobIfPresent
public void updateReIndexJobIfPresent(Consumer<ReIndexJob> updater) throws InterruptedException, TimeoutException
Try to update running re-index job in an atomic operation, synchronised by a cluster-wide lock.- Specified by:
updateReIndexJobIfPresentin interfaceReIndexJobManagerInternal- Parameters:
updater- a callback to mutate runningReIndexJob- Throws:
InterruptedException- if interrupted while waiting to update the jobTimeoutException- if cannot obtain exclusive access in order to update the job within reasonable time
-
clear
public void clear()
Description copied from interface:ReIndexJobManagerInternalDelete most recent or running re-index job. No-op if there is neither- Specified by:
clearin interfaceReIndexJobManagerInternal
-
onIndexRebuildStarted
@EventListener public void onIndexRebuildStarted(ReindexStartedEvent startedEvent)
-
onIndexRebuildFinished
@EventListener public void onIndexRebuildFinished(ReindexFinishedEvent ignored) throws InterruptedException
- Throws:
InterruptedException
-
onRestoreIndexSnapshotStartedEvent
@EventListener public void onRestoreIndexSnapshotStartedEvent(RestoreIndexSnapshotStartedEvent ignored) throws InterruptedException
- Throws:
InterruptedException
-
onIndexSnapshotCreationFailedEvent
@EventListener public void onIndexSnapshotCreationFailedEvent(IndexSnapshotCreationFailedEvent failedEvent) throws InterruptedException
- Throws:
InterruptedException
-
onIndexSnapshotRestoredSuccessfullyEvent
@EventListener public void onIndexSnapshotRestoredSuccessfullyEvent(IndexSnapshotRestoredSuccessfullyEvent ignored) throws InterruptedException
- Throws:
InterruptedException
-
onIndexSnapshotRestorationFailedEvent
@EventListener public void onIndexSnapshotRestorationFailedEvent(IndexSnapshotRestorationFailedEvent failedEvent) throws InterruptedException
- Throws:
InterruptedException
-
-