@PublicApi public interface

ReindexRequestManager

com.atlassian.jira.index.request.ReindexRequestManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Used for persistence and control of reindex requests.

Summary

Public Methods
void clearAll()
Clear any pending requests.
@Nonnull List<ReindexRequest> failRunningRequestsFromDeadNodes()
Finds any active or running requests from inactive nodes in the cluster and transitions them to failed.
@Nonnull List<ReindexRequest> failRunningRequestsFromNode(String nodeId)
Finds any active or running requests from the specified node in the cluster and transitions them to failed.
@Nonnull Iterable<ReindexRequest> getPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes)
Retrieves all pending reindex requests, in order from oldest to newest.
@Nonnull Set<ReindexRequest> getReindexProgress(Set<Long> requestIds)
Retrieves the progress of some requests.
boolean isReindexInProgress()
boolean isReindexRequested(Set<ReindexRequestType> reindexRequestTypes)
Checks if any ReindexRequests are waiting to be processed.
boolean isReindexRequested()
Checks if any ReindexRequests of any type are waiting to be processed.
Set<ReindexRequest> processPendingRequests(boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground)
Process any outstanding reindex requests.
@Nonnull ReindexRequest requestReindex(ReindexRequestType type, Set<AffectedIndex> affectedIndexes, Set<SharedEntityType> entityTypes)
Requests a reindex.
@Nonnull List<ReindexRequest> transitionStatus(Iterable<ReindexRequest> requests, ReindexStatus newStatus)
Transitions the status of reindex requests.
@Nonnull ReindexRequest transitionStatus(ReindexRequest request, ReindexStatus newStatus)
Transitions the status of a reindex request.

Public Methods

public void clearAll ()

Clear any pending requests.

@Nonnull public List<ReindexRequest> failRunningRequestsFromDeadNodes ()

Finds any active or running requests from inactive nodes in the cluster and transitions them to failed. Use this to clean up any tasks from nodes that were running on nodes that were killed.

Returns
  • the list of requests that were transitioned.

@Nonnull public List<ReindexRequest> failRunningRequestsFromNode (String nodeId)

Finds any active or running requests from the specified node in the cluster and transitions them to failed.

Parameters
nodeId the ID of the cluster node, or null if not clustered.
Returns
  • the list of requests that were transitioned.

@Nonnull public Iterable<ReindexRequest> getPendingReindexRequests (Set<ReindexRequestType> reindexRequestTypes)

Retrieves all pending reindex requests, in order from oldest to newest.

Parameters
reindexRequestTypes Types of requests to check for.
Returns
  • a list of reindex requests.

@Nonnull public Set<ReindexRequest> getReindexProgress (Set<Long> requestIds)

Retrieves the progress of some requests.

Parameters
requestIds the set of reindex request IDs to look up.
Returns
  • set of requests indicating progress. Any request IDs that were not found will not have a corresponding entry in this result set.

public boolean isReindexInProgress ()

Returns
  • true if a reindex is in progress, false if not.

public boolean isReindexRequested (Set<ReindexRequestType> reindexRequestTypes)

Checks if any ReindexRequests are waiting to be processed.

Parameters
reindexRequestTypes Types of requests to check for.
Returns
  • true if unprocessed requests exist

public boolean isReindexRequested ()

Checks if any ReindexRequests of any type are waiting to be processed.

Returns
  • true if unprocessed requests exist

public Set<ReindexRequest> processPendingRequests (boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground)

Process any outstanding reindex requests.

Parameters
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
Returns
  • The updated processed requests.

@Nonnull public ReindexRequest requestReindex (ReindexRequestType type, Set<AffectedIndex> affectedIndexes, Set<SharedEntityType> entityTypes)

Requests a reindex.

Parameters
type whether reindex is immediate or delayed.
affectedIndexes the indexes to regenerate.
entityTypes the entity types whose indexes are to be regenerated.
Returns
  • the request that was created.

@Nonnull public List<ReindexRequest> transitionStatus (Iterable<ReindexRequest> requests, ReindexStatus newStatus)

Transitions the status of reindex requests.

Parameters
requests the requests.
newStatus the new status to transition to.
Returns
  • the updated requests.

@Nonnull public ReindexRequest transitionStatus (ReindexRequest request, ReindexStatus newStatus)

Transitions the status of a reindex request.

Parameters
request the request.
newStatus the new status to transition to.
Returns
  • the updated request.