@PublicApi public interface

IndexLifecycleManager

implements Shutdown Sized
com.atlassian.jira.util.index.IndexLifecycleManager
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

Manage an index lifecycle.

Summary

Public Methods
long activate(Context context)
Activates search indexes.
long activate(Context context, boolean reindex)
Activates search indexes.
void deactivate()
De-activates indexing (as happens from the admin page) and removes index directories.
Collection<String> getAllIndexPaths()
boolean isIndexAvailable()
Whether this index is available.
boolean isIndexConsistent()
boolean isIndexingEnabled()
This method is deprecated. since v6.3.3 Use isIndexAvailable()
long optimize()
Optimize the underlying indexes.
long reIndexAll(Context context)
long reIndexAll(Context context, IssueIndexingParams issueIndexingParams)
Reindex indexes defined by the IssueIndexingParams.
long reIndexAllIssuesInBackground(Context context)
Reindex everything, but don't stop the world Comments and change history will not be reindexed.
@Deprecated long reIndexAllIssuesInBackground(Context context, boolean reIndexComments, boolean reIndexChangeHistory)
long reIndexIssuesInBackground(Context context, IssueIndexingParams issueIndexingParams)
Reindex everything, but don't stop the world
void shutdown()
Shuts down the indexing manager and closes its resources (if any).
int size()
[Expand]
Inherited Methods
From interface com.atlassian.jira.util.Shutdown
From interface com.atlassian.jira.util.collect.Sized

Public Methods

public long activate (Context context)

Activates search indexes. This will rebuild the indexes.

Parameters
context used to report progress back to the user or to the logs. Must not be null.
Returns
  • Reindex time in ms

public long activate (Context context, boolean reindex)

Activates search indexes.

Parameters
context used to report progress back to the user or to the logs. Must not be null.
reindex reindex after activation.
Returns
  • Reindex time in ms

public void deactivate ()

De-activates indexing (as happens from the admin page) and removes index directories.

public Collection<String> getAllIndexPaths ()

Returns
  • a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.

public boolean isIndexAvailable ()

Whether this index is available. The index is not available if the index is being rebuilt or recovered. In a clustered environment this reflects only the state on the local node.

Returns
  • Whether this index is available.

public boolean isIndexConsistent ()

Returns
  • the result of a simple consistency check that compares the index state to the current number of issues. A background re-index should not be attempted when this returns false.

public boolean isIndexingEnabled ()

This method is deprecated.
since v6.3.3 Use isIndexAvailable()

Returns
  • whether this index is enabled or true if all sub indexes are enabled

public long optimize ()

Optimize the underlying indexes. Make the subsequent searching more efficient.

Returns
  • the amount of time in millis this method took (because you are too lazy to time me), 0 if indexing is not enabled or -1 if we cannot obtain the index writeLock.
Throws
IndexException if the indexes are seriously in trouble

public long reIndexAll (Context context)

This method is deprecated.
Use reIndexAll(com.atlassian.jira.task.context.Context, com.atlassian.jira.issue.index.IssueIndexingParams) instead. Since v6.4.

Reindex everything.

Parameters
context used to report progress back to the user or to the logs. Must not be null.
Returns
  • Reindex time in ms.

public long reIndexAll (Context context, IssueIndexingParams issueIndexingParams)

Reindex indexes defined by the IssueIndexingParams.

Parameters
context used to report progress back to the user or to the logs. Must not be null.
issueIndexingParams indexes to reindex.
Returns
  • Reindex time in ms.

public long reIndexAllIssuesInBackground (Context context)

Reindex everything, but don't stop the world Comments and change history will not be reindexed.

Parameters
context used to report progress back to the user or to the logs. Must not be null.
Returns
  • Reindex time in ms.

@Deprecated public long reIndexAllIssuesInBackground (Context context, boolean reIndexComments, boolean reIndexChangeHistory)

This method is deprecated.
since v6.4 use reIndexIssuesInBackground(com.atlassian.jira.task.context.Context, com.atlassian.jira.issue.index.IssueIndexingParams)

Reindex everything, but don't stop the world

Parameters
context used to report progress back to the user or to the logs. Must not be null.
reIndexComments Also reindex all the issue comments.
reIndexChangeHistory Also reindex the issue change history.
Returns
  • Reindex time in ms.

public long reIndexIssuesInBackground (Context context, IssueIndexingParams issueIndexingParams)

Reindex everything, but don't stop the world

Parameters
context used to report progress back to the user or to the logs. Must not be null.
issueIndexingParams determines witch related objects should be indexed together with issue.
Returns
  • Reindex time in ms.

public void shutdown ()

Shuts down the indexing manager and closes its resources (if any).

public int size ()

Returns