Package com.atlassian.jira.util.index
Class DefaultCompositeIndexLifecycleManager
java.lang.Object
com.atlassian.jira.util.index.DefaultCompositeIndexLifecycleManager
- All Implemented Interfaces:
Sized,CompositeIndexLifecycleManager,IndexLifecycleManager,Shutdown
public class DefaultCompositeIndexLifecycleManager
extends Object
implements CompositeIndexLifecycleManager
Convenience class for managing known IndexManagers and calling them all.
- Since:
- v5.0
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCompositeIndexLifecycleManager(IssueIndexManager issueIndexManager, SharedEntityIndexManager sharedEntityIndexManager, IndexingCounterManager indexingCounterManager) -
Method Summary
Modifier and TypeMethodDescriptionlongActivates search indexes.longActivates search indexes.voidDe-activates indexing (as happens from the admin page) and removes index directories.booleanisEmpty()booleanWhether this index is available.booleanlongoptimize()Optimize the underlying indexes.longreIndexAll(Context context) Reindex everything.longreIndexAll(Context context, IssueIndexingParams issueIndexingParams) Reindex indexes defined by theIssueIndexingParams.longreIndexAllIssuesInBackground(Context context) Reindex everything, but don't stop the world Comments and change history will not be reindexed.longreIndexIssuesInBackground(Context context, IssueIndexingParams issueIndexingParams) Reindex everything, but don't stop the worldvoidshutdown()Shuts down the indexing manager and closes its resources (if any).intsize()
-
Constructor Details
-
Method Details
-
optimize
public long optimize()Description copied from interface:IndexLifecycleManagerOptimize the underlying indexes. Make the subsequent searching more efficient.- Specified by:
optimizein interfaceIndexLifecycleManager- 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.
-
reIndexAll
Description copied from interface:IndexLifecycleManagerReindex everything.- Specified by:
reIndexAllin interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms.
-
reIndexAll
Description copied from interface:IndexLifecycleManagerReindex indexes defined by theIssueIndexingParams.- Specified by:
reIndexAllin interfaceIndexLifecycleManager- 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.
-
reIndexAllIssuesInBackground
Description copied from interface:IndexLifecycleManagerReindex everything, but don't stop the world Comments and change history will not be reindexed.- Specified by:
reIndexAllIssuesInBackgroundin interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms.
-
reIndexIssuesInBackground
Description copied from interface:IndexLifecycleManagerReindex everything, but don't stop the world- Specified by:
reIndexIssuesInBackgroundin interfaceIndexLifecycleManager- 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.
-
shutdown
public void shutdown()Description copied from interface:IndexLifecycleManagerShuts down the indexing manager and closes its resources (if any).- Specified by:
shutdownin interfaceIndexLifecycleManager- Specified by:
shutdownin interfaceShutdown
-
activate
Description copied from interface:IndexLifecycleManagerActivates search indexes. This will rebuild the indexes.- Specified by:
activatein interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms
-
activate
Description copied from interface:IndexLifecycleManagerActivates search indexes.- Specified by:
activatein interfaceIndexLifecycleManager- 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
-
deactivate
public void deactivate()Description copied from interface:IndexLifecycleManagerDe-activates indexing (as happens from the admin page) and removes index directories.- Specified by:
deactivatein interfaceIndexLifecycleManager
-
isIndexAvailable
public boolean isIndexAvailable()Description copied from interface:IndexLifecycleManagerWhether 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.- Specified by:
isIndexAvailablein interfaceIndexLifecycleManager- Returns:
- Whether this index is available.
-
isIndexConsistent
public boolean isIndexConsistent()- Specified by:
isIndexConsistentin interfaceIndexLifecycleManager- 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. Note thatfalseis also returned if the index is not available .
-
getAllIndexPaths
- Specified by:
getAllIndexPathsin interfaceIndexLifecycleManager- Returns:
- a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.
-
size
public int size()- Specified by:
sizein interfaceIndexLifecycleManager- Specified by:
sizein interfaceSized- Returns:
- how many Entities will be re-indexed by
IndexLifecycleManager.reIndexAll(Context)
-
isEmpty
public boolean isEmpty()
-