Class DefaultReIndexJobManager
java.lang.Object
com.atlassian.confluence.internal.index.status.DefaultReIndexJobManager
- All Implemented Interfaces:
ReIndexJobManager
,ReIndexJobManagerInternal
This implementation of
ReIndexJobManager
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
Modifier and TypeMethodDescriptionboolean
Mark most recent or running re-index job as acknowledged.void
clear()
Delete most recent or running re-index job.createNewJob
(List<String> spaceKeys) Create a new job which may replace a completed job stored in the bandana table.createNewJob
(List<String> spaceKeys, EnumSet<ReIndexOption> reIndexOptions) Create a new job with the given space keys and reindex options.boolean
Returns true if an in progress reindex job exists in the clustervoid
onIndexRebuildFinished
(ReindexFinishedEvent reindexFinishedEvent) void
onIndexRebuildSkipped
(ReindexSkippedEvent reindexSkippedEvent) void
onIndexRebuildStarted
(ReindexStartedEvent startedEvent) void
void
void
void
onIndexSnapshotRestorationSkippedEvent
(IndexSnapshotRestorationSkippedEvent indexSnapshotRestorationSkippedEvent) void
onIndexSnapshotRestoredSuccessfullyEvent
(IndexSnapshotRestoredSuccessfullyEvent indexSnapshotRestoredSuccessfullyEvent) void
onReIndexFailedEvent
(ReIndexFailedEvent reIndexFailedEvent) void
onReIndexRequest
(ReIndexRequestEvent reIndexRequestEvent) void
onReIndexRequestFailed
(ReIndexRequestFailedEvent reIndexRequestFailedEvent) void
void
void
register()
void
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 Details
-
register
@PostConstruct public void register() -
unregister
@PreDestroy public void unregister() -
getRunningOrMostRecentReIndex
- Specified by:
getRunningOrMostRecentReIndex
in interfaceReIndexJobManager
- Returns:
- most recent or running re-index job. Empty if there is neither.
-
acknowledgeRunningJob
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
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
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
-
createNewJob
public Optional<ReIndexJob> createNewJob(List<String> spaceKeys, EnumSet<ReIndexOption> reIndexOptions) Description copied from interface:ReIndexJobManager
Create a new job with the given space keys and reindex options.- Specified by:
createNewJob
in interfaceReIndexJobManager
-
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
-
onReIndexRequestFailed
@EventListener public void onReIndexRequestFailed(ReIndexRequestFailedEvent reIndexRequestFailedEvent) -
onIndexRebuildStarted
-
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
-
onIndexSnapshotCreationSuccessfulEvent
@EventListener public void onIndexSnapshotCreationSuccessfulEvent(IndexSnapshotCreationSuccessfulEvent successfulEvent) 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
-
onReIndexFailedEvent
@EventListener public void onReIndexFailedEvent(ReIndexFailedEvent reIndexFailedEvent) throws InterruptedException - Throws:
InterruptedException
-
onSourceNodeLeftClusterDuringPropagationEvent
@EventListener public void onSourceNodeLeftClusterDuringPropagationEvent(SourceNodeLeftClusterDuringPropagationEvent event) throws InterruptedException - Throws:
InterruptedException
-