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 Details

  • Method Details

    • optimize

      public long optimize()
      Description copied from interface: IndexLifecycleManager
      Optimize the underlying indexes. Make the subsequent searching more efficient.
      Specified by:
      optimize in interface IndexLifecycleManager
      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

      public long reIndexAll(Context context)
      Description copied from interface: IndexLifecycleManager
      Reindex everything.
      Specified by:
      reIndexAll in interface IndexLifecycleManager
      Parameters:
      context - used to report progress back to the user or to the logs. Must not be null.
      Returns:
      Reindex time in ms.
    • reIndexAll

      public long reIndexAll(Context context, IssueIndexingParams issueIndexingParams)
      Description copied from interface: IndexLifecycleManager
      Reindex indexes defined by the IssueIndexingParams.
      Specified by:
      reIndexAll in interface IndexLifecycleManager
      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

      public long reIndexAllIssuesInBackground(Context context)
      Description copied from interface: IndexLifecycleManager
      Reindex everything, but don't stop the world Comments and change history will not be reindexed.
      Specified by:
      reIndexAllIssuesInBackground in interface IndexLifecycleManager
      Parameters:
      context - used to report progress back to the user or to the logs. Must not be null.
      Returns:
      Reindex time in ms.
    • reIndexIssuesInBackground

      public long reIndexIssuesInBackground(Context context, IssueIndexingParams issueIndexingParams)
      Description copied from interface: IndexLifecycleManager
      Reindex everything, but don't stop the world
      Specified by:
      reIndexIssuesInBackground in interface IndexLifecycleManager
      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: IndexLifecycleManager
      Shuts down the indexing manager and closes its resources (if any).
      Specified by:
      shutdown in interface IndexLifecycleManager
      Specified by:
      shutdown in interface Shutdown
    • activate

      public long activate(Context context)
      Description copied from interface: IndexLifecycleManager
      Activates search indexes. This will rebuild the indexes.
      Specified by:
      activate in interface IndexLifecycleManager
      Parameters:
      context - used to report progress back to the user or to the logs. Must not be null.
      Returns:
      Reindex time in ms
    • activate

      public long activate(Context context, boolean reindex)
      Description copied from interface: IndexLifecycleManager
      Activates search indexes.
      Specified by:
      activate in interface IndexLifecycleManager
      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: IndexLifecycleManager
      De-activates indexing (as happens from the admin page) and removes index directories.
      Specified by:
      deactivate in interface IndexLifecycleManager
    • isIndexAvailable

      public boolean isIndexAvailable()
      Description copied from interface: IndexLifecycleManager
      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.
      Specified by:
      isIndexAvailable in interface IndexLifecycleManager
      Returns:
      Whether this index is available.
    • isIndexConsistent

      public boolean isIndexConsistent()
      Specified by:
      isIndexConsistent in interface IndexLifecycleManager
      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 that false is also returned if the index is not available .
    • getAllIndexPaths

      public Collection<String> getAllIndexPaths()
      Specified by:
      getAllIndexPaths in interface IndexLifecycleManager
      Returns:
      a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.
    • size

      public int size()
      Specified by:
      size in interface IndexLifecycleManager
      Specified by:
      size in interface Sized
      Returns:
      how many Entities will be re-indexed by IndexLifecycleManager.reIndexAll(Context)
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Sized