public class DefaultReindexRequestManager extends Object implements ReindexRequestManager
Constructor and Description |
---|
DefaultReindexRequestManager(ReindexRequestDao reindexRequestDao,
com.atlassian.core.util.Clock clock,
ReindexRequestCoalescer requestCoalescer,
ClusterManager clusterManager,
com.atlassian.beehive.ClusterLockService clusterLockService,
TaskManager taskManager,
IndexLifecycleManager indexLifecycleManager,
I18nHelper.BeanFactory i18nFactory,
I18nHelper i18nHelper,
JohnsonProvider johnsonProvider) |
Modifier and Type | Method and Description |
---|---|
void |
clearAll()
Clear any pending requests.
|
List<ReindexRequest> |
failRunningRequestsFromDeadNodes()
Finds any active or running requests from inactive nodes in the cluster and transitions them
to failed.
|
List<ReindexRequest> |
failRunningRequestsFromNode(String nodeId)
Finds any active or running requests from the specified node in the cluster and transitions them to failed.
|
Iterable<ReindexRequest> |
getPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes)
Retrieves all pending reindex requests, in order
from oldest to newest.
|
ReindexRequest |
getReindexProgress(Long requestId) |
Set<ReindexRequest> |
getReindexProgress(Set<Long> requestIds)
Retrieves the progress of some requests.
|
boolean |
isReindexInProgress() |
boolean |
isReindexRequested()
Checks if any ReindexRequests of any type are waiting to be processed.
|
boolean |
isReindexRequested(Set<ReindexRequestType> reindexRequestTypes)
Checks if any ReindexRequests are waiting to be processed.
|
protected ReindexRequest |
performReindex(ReindexRequest request,
boolean waitForCompletion,
boolean runInBackground) |
Set<ReindexRequest> |
processPendingRequests(boolean waitForCompletion,
Set<ReindexRequestType> reindexRequestTypes,
boolean runInBackground)
Process any outstanding reindex requests.
|
Iterable<ReindexRequest> |
readPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes,
boolean updateCoalescedRequests) |
ReindexRequest |
requestReindex(ReindexRequestType type,
Set<AffectedIndex> affectedIndexes,
Set<SharedEntityType> entityTypes)
Requests a reindex.
|
List<ReindexRequest> |
transitionStatus(Iterable<ReindexRequest> requests,
ReindexStatus newStatus)
Transitions the status of reindex requests.
|
ReindexRequest |
transitionStatus(ReindexRequest request,
ReindexStatus newStatus)
Transitions the status of a reindex request.
|
public DefaultReindexRequestManager(ReindexRequestDao reindexRequestDao, com.atlassian.core.util.Clock clock, ReindexRequestCoalescer requestCoalescer, ClusterManager clusterManager, com.atlassian.beehive.ClusterLockService clusterLockService, TaskManager taskManager, IndexLifecycleManager indexLifecycleManager, I18nHelper.BeanFactory i18nFactory, I18nHelper i18nHelper, JohnsonProvider johnsonProvider)
public boolean isReindexRequested()
ReindexRequestManager
isReindexRequested
in interface ReindexRequestManager
public boolean isReindexRequested(Set<ReindexRequestType> reindexRequestTypes)
ReindexRequestManager
isReindexRequested
in interface ReindexRequestManager
reindexRequestTypes
- Types of requests to check for.@Nonnull public Iterable<ReindexRequest> getPendingReindexRequests(@Nonnull Set<ReindexRequestType> reindexRequestTypes)
ReindexRequestManager
getPendingReindexRequests
in interface ReindexRequestManager
reindexRequestTypes
- Types of requests to check for.@Nonnull public Iterable<ReindexRequest> readPendingReindexRequests(@Nonnull Set<ReindexRequestType> reindexRequestTypes, boolean updateCoalescedRequests)
public Set<ReindexRequest> processPendingRequests(boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground)
ReindexRequestManager
processPendingRequests
in interface ReindexRequestManager
waitForCompletion
- If true this method will not return until the reindexing is complete, otherwise it will return
when the reindex task is submitted,reindexRequestTypes
- Types of requests to process either ReindexRequestType
runInBackground
- If true the reindex should be a background reindex otherwise a foreground stop the world reindex@Nonnull protected ReindexRequest performReindex(@Nonnull ReindexRequest request, boolean waitForCompletion, boolean runInBackground) throws InterruptedException
InterruptedException
@Nonnull public List<ReindexRequest> failRunningRequestsFromDeadNodes()
ReindexRequestManager
failRunningRequestsFromDeadNodes
in interface ReindexRequestManager
@Nonnull public List<ReindexRequest> failRunningRequestsFromNode(@Nullable String nodeId)
ReindexRequestManager
failRunningRequestsFromNode
in interface ReindexRequestManager
nodeId
- the ID of the cluster node, or null if not clustered.public boolean isReindexInProgress()
isReindexInProgress
in interface ReindexRequestManager
@Nonnull public ReindexRequest requestReindex(@Nonnull ReindexRequestType type, @Nonnull Set<AffectedIndex> affectedIndexes, @Nonnull Set<SharedEntityType> entityTypes)
ReindexRequestManager
requestReindex
in interface ReindexRequestManager
type
- whether reindex is immediate or delayed.affectedIndexes
- the indexes to regenerate.entityTypes
- the entity types whose indexes are to be regenerated.@Nonnull public List<ReindexRequest> transitionStatus(@Nonnull Iterable<ReindexRequest> requests, @Nonnull ReindexStatus newStatus)
ReindexRequestManager
transitionStatus
in interface ReindexRequestManager
requests
- the requests.newStatus
- the new status to transition to.@Nonnull public ReindexRequest transitionStatus(@Nonnull ReindexRequest request, @Nonnull ReindexStatus newStatus)
ReindexRequestManager
transitionStatus
in interface ReindexRequestManager
request
- the request.newStatus
- the new status to transition to.@Nonnull public Set<ReindexRequest> getReindexProgress(@Nonnull Set<Long> requestIds)
ReindexRequestManager
getReindexProgress
in interface ReindexRequestManager
requestIds
- the set of reindex request IDs to look up.public void clearAll()
ReindexRequestManager
clearAll
in interface ReindexRequestManager
public ReindexRequest getReindexProgress(@Nonnull Long requestId)
Copyright © 2002-2016 Atlassian. All Rights Reserved.