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 ofReIndexJobManager
listens 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
JOB_PERSISTER_LOCK_NAME, REINDEX_IMPROVEMENT_DARKFEATURE_KEY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acknowledgeRunningJob()
Mark most recent or running re-index job as acknowledged.void
clear()
Delete most recent or running re-index job.Optional<ReIndexJob>
createNewJob(List<String> spaceKeys)
Create a new job which may replace a completed job stored in the bandana table.Optional<ReIndexJob>
getRunningOrMostRecentReIndex()
boolean
isReIndexing()
Returns true if an in progress reindex job exists in the clustervoid
onIndexRebuildFinished(ReindexFinishedEvent reindexFinishedEvent)
void
onIndexRebuildSkipped(ReindexSkippedEvent reindexSkippedEvent)
void
onIndexRebuildStarted(ReindexStartedEvent startedEvent)
void
onIndexSnapshotCreationFailedEvent(IndexSnapshotCreationFailedEvent failedEvent)
void
onIndexSnapshotRestorationFailedEvent(IndexSnapshotRestorationFailedEvent failedEvent)
void
onIndexSnapshotRestorationSkippedEvent(IndexSnapshotRestorationSkippedEvent indexSnapshotRestorationSkippedEvent)
void
onIndexSnapshotRestoredSuccessfullyEvent(IndexSnapshotRestoredSuccessfullyEvent indexSnapshotRestoredSuccessfullyEvent)
void
onReIndexRequest(ReIndexRequestEvent reIndexRequestEvent)
void
onRestoreIndexSnapshotStartedEvent(RestoreIndexSnapshotStartedEvent ignored)
void
register()
void
unregister()
void
updateReIndexJob(ReIndexJob reIndexJob)
Update the reindexJob in an atomic operation (i.e.void
updateReIndexJobIfPresent(Consumer<ReIndexJob> updater)
Try to update running re-index job in an atomic operation, synchronised by a cluster-wide lock.
-
-
-
Method Detail
-
register
@PostConstruct public void register()
-
unregister
@PreDestroy public void unregister()
-
getRunningOrMostRecentReIndex
public Optional<ReIndexJob> getRunningOrMostRecentReIndex()
- Specified by:
getRunningOrMostRecentReIndex
in interfaceReIndexJobManager
- Returns:
- most recent or running re-index job. Empty if there is neither.
-
acknowledgeRunningJob
public boolean acknowledgeRunningJob() throws InterruptedException
Description copied from interface:ReIndexJobManager
Mark most recent or running re-index job as acknowledged. No-op if there is neither.- Specified by:
acknowledgeRunningJob
in 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:
updateReIndexJobIfPresent
in 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
-
updateReIndexJob
public void updateReIndexJob(ReIndexJob reIndexJob) throws InterruptedException, TimeoutException
Description copied from interface:ReIndexJobManagerInternal
Update the reindexJob in an atomic operation (i.e. with a cluster lock)- Specified by:
updateReIndexJob
in interfaceReIndexJobManagerInternal
- Throws:
InterruptedException
TimeoutException
-
isReIndexing
public boolean isReIndexing()
Description copied from interface:ReIndexJobManager
Returns true if an in progress reindex job exists in the cluster- Specified by:
isReIndexing
in interfaceReIndexJobManager
-
createNewJob
public Optional<ReIndexJob> createNewJob(List<String> spaceKeys)
Description copied from interface:ReIndexJobManager
Create a new job which may replace a completed job stored in the bandana table.- Specified by:
createNewJob
in interfaceReIndexJobManager
- Returns:
- the new job if it can be created
-
clear
public void clear()
Description copied from interface:ReIndexJobManager
Delete most recent or running re-index job. No-op if there is neither- Specified by:
clear
in interfaceReIndexJobManager
-
onReIndexRequest
@EventListener public void onReIndexRequest(ReIndexRequestEvent reIndexRequestEvent)
-
onIndexRebuildStarted
@EventListener public void onIndexRebuildStarted(ReindexStartedEvent startedEvent)
-
onIndexRebuildFinished
@EventListener public void onIndexRebuildFinished(ReindexFinishedEvent reindexFinishedEvent) throws InterruptedException
- Throws:
InterruptedException
-
onIndexRebuildSkipped
@EventListener public void onIndexRebuildSkipped(ReindexSkippedEvent reindexSkippedEvent) 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 indexSnapshotRestoredSuccessfullyEvent) throws InterruptedException
- Throws:
InterruptedException
-
onIndexSnapshotRestorationFailedEvent
@EventListener public void onIndexSnapshotRestorationFailedEvent(IndexSnapshotRestorationFailedEvent failedEvent) throws InterruptedException
- Throws:
InterruptedException
-
onIndexSnapshotRestorationSkippedEvent
@EventListener public void onIndexSnapshotRestorationSkippedEvent(IndexSnapshotRestorationSkippedEvent indexSnapshotRestorationSkippedEvent) throws InterruptedException
- Throws:
InterruptedException
-
-