public class DefaultReIndexJobManager extends Object implements ReIndexJobManagerInternal
ReIndexJobManager
listens to indexing-related events and update re-index status accordinglyREINDEX_IMPROVEMENT_DARKFEATURE_KEY
Constructor and 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) |
Modifier and Type | Method and 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> |
getRunningOrMostRecentReIndex() |
void |
onIndexRebuildFinished(ReindexFinishedEvent ignored) |
void |
onIndexRebuildStarted(ReindexStartedEvent startedEvent) |
void |
onIndexSnapshotCreationFailedEvent(IndexSnapshotCreationFailedEvent failedEvent) |
void |
onIndexSnapshotRestorationFailedEvent(IndexSnapshotRestorationFailedEvent failedEvent) |
void |
onIndexSnapshotRestoredSuccessfullyEvent(IndexSnapshotRestoredSuccessfullyEvent ignored) |
void |
onRestoreIndexSnapshotStartedEvent(RestoreIndexSnapshotStartedEvent ignored) |
void |
register() |
void |
unregister() |
void |
updateReIndexJobIfPresent(Consumer<ReIndexJob> updater)
Try to update running re-index job in an atomic operation, synchronised by a cluster-wide lock.
|
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)
@PostConstruct public void register()
@PreDestroy public void unregister()
public Optional<ReIndexJob> getRunningOrMostRecentReIndex()
getRunningOrMostRecentReIndex
in interface ReIndexJobManager
public boolean acknowledgeRunningJob() throws InterruptedException
ReIndexJobManager
acknowledgeRunningJob
in interface ReIndexJobManager
InterruptedException
- if interrupted when trying to ack the jobpublic void updateReIndexJobIfPresent(Consumer<ReIndexJob> updater) throws InterruptedException, TimeoutException
updateReIndexJobIfPresent
in interface ReIndexJobManagerInternal
updater
- a callback to mutate running ReIndexJob
InterruptedException
- if interrupted while waiting to update the jobTimeoutException
- if cannot obtain exclusive access in order to update the job within reasonable timepublic void clear()
ReIndexJobManagerInternal
clear
in interface ReIndexJobManagerInternal
@EventListener public void onIndexRebuildStarted(ReindexStartedEvent startedEvent)
@EventListener public void onIndexRebuildFinished(ReindexFinishedEvent ignored) throws InterruptedException
InterruptedException
@EventListener public void onRestoreIndexSnapshotStartedEvent(RestoreIndexSnapshotStartedEvent ignored) throws InterruptedException
InterruptedException
@EventListener public void onIndexSnapshotCreationFailedEvent(IndexSnapshotCreationFailedEvent failedEvent) throws InterruptedException
InterruptedException
@EventListener public void onIndexSnapshotRestoredSuccessfullyEvent(IndexSnapshotRestoredSuccessfullyEvent ignored) throws InterruptedException
InterruptedException
@EventListener public void onIndexSnapshotRestorationFailedEvent(IndexSnapshotRestorationFailedEvent failedEvent) throws InterruptedException
InterruptedException
Copyright © 2003–2020 Atlassian. All rights reserved.