Class ZkStateReader.AliasesManager

java.lang.Object
org.apache.solr.common.cloud.ZkStateReader.AliasesManager
All Implemented Interfaces:
org.apache.zookeeper.Watcher
Enclosing class:
ZkStateReader

public class ZkStateReader.AliasesManager extends Object implements org.apache.zookeeper.Watcher
A class to manage the aliases instance, including watching for changes. There should only ever be one instance of this class per instance of ZkStateReader. Normally it will not be useful to create a new instance since this watcher automatically re-registers itself every time it is updated.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher

    org.apache.zookeeper.Watcher.Event, org.apache.zookeeper.Watcher.WatcherType
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyModificationAndExportToZk(UnaryOperator<org.apache.solr.common.cloud.Aliases> op)
    Writes an updated Aliases to zk.
    org.apache.solr.common.cloud.Aliases
     
    void
    process(org.apache.zookeeper.WatchedEvent event)
     
    boolean
    Ensures the internal aliases is up-to-date.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AliasesManager

      public AliasesManager()
  • Method Details

    • getAliases

      public org.apache.solr.common.cloud.Aliases getAliases()
    • applyModificationAndExportToZk

      public void applyModificationAndExportToZk(UnaryOperator<org.apache.solr.common.cloud.Aliases> op)
      Writes an updated Aliases to zk. It will retry if there are races with other modifications, giving up after 30 seconds with a SolrException. The caller should understand it's possible the aliases has further changed if it examines it.
    • update

      public boolean update() throws org.apache.zookeeper.KeeperException, InterruptedException
      Ensures the internal aliases is up-to-date. If there is a change, return true.
      Returns:
      true if an update was performed
      Throws:
      org.apache.zookeeper.KeeperException
      InterruptedException
    • process

      public void process(org.apache.zookeeper.WatchedEvent event)
      Specified by:
      process in interface org.apache.zookeeper.Watcher