Class HelixFactory


  • public class HelixFactory
    extends java.lang.Object
    A factory class to construct and get a reference to a HelixManager
    • Constructor Summary

      Constructors 
      Constructor Description
      HelixFactory()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.github.ambry.clustermap.DataNodeConfigSource getDataNodeConfigSource​(com.github.ambry.config.ClusterMapConfig clusterMapConfig, java.lang.String zkAddr, com.github.ambry.clustermap.DataNodeConfigSourceMetrics metrics)  
      org.apache.helix.HelixManager getZKHelixManager​(java.lang.String clusterName, java.lang.String instanceName, org.apache.helix.InstanceType instanceType, java.lang.String zkAddr)
      Get a reference to a HelixManager
      org.apache.helix.HelixManager getZkHelixManagerAndConnect​(java.lang.String clusterName, java.lang.String instanceName, org.apache.helix.InstanceType instanceType, java.lang.String zkAddr)
      Get a reference to a HelixManager and connect to it, if not already connected
      • Methods inherited from class java.lang.Object

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

      • HelixFactory

        public HelixFactory()
    • Method Detail

      • getZKHelixManager

        public org.apache.helix.HelixManager getZKHelixManager​(java.lang.String clusterName,
                                                               java.lang.String instanceName,
                                                               org.apache.helix.InstanceType instanceType,
                                                               java.lang.String zkAddr)
        Get a reference to a HelixManager
        Parameters:
        clusterName - the name of the cluster for which the manager is to be gotten.
        instanceName - the name of the instance on whose behalf the manager is to be gotten.
        instanceType - the InstanceType of the requester.
        zkAddr - the address identifying the zk service to which this request is to be made.
        Returns:
        the constructed HelixManager.
      • getZkHelixManagerAndConnect

        public org.apache.helix.HelixManager getZkHelixManagerAndConnect​(java.lang.String clusterName,
                                                                         java.lang.String instanceName,
                                                                         org.apache.helix.InstanceType instanceType,
                                                                         java.lang.String zkAddr)
                                                                  throws java.lang.Exception
        Get a reference to a HelixManager and connect to it, if not already connected
        Parameters:
        clusterName - the name of the cluster for which the manager is to be gotten.
        instanceName - the name of the instance on whose behalf the manager is to be gotten.
        instanceType - the InstanceType of the requester.
        zkAddr - the address identifying the zk service to which this request is to be made.
        Returns:
        the constructed and connected HelixManager.
        Throws:
        java.lang.Exception - if connecting failed.
      • getDataNodeConfigSource

        public com.github.ambry.clustermap.DataNodeConfigSource getDataNodeConfigSource​(com.github.ambry.config.ClusterMapConfig clusterMapConfig,
                                                                                        java.lang.String zkAddr,
                                                                                        com.github.ambry.clustermap.DataNodeConfigSourceMetrics metrics)
        Parameters:
        clusterMapConfig - the ClusterMapConfig to use.
        zkAddr - the ZooKeeper address to connect to. If a HelixManager is required and one is already in the pool with this address, it will be reused.
        metrics - the DataNodeConfigSourceMetrics to use.
        Returns:
        either a new instance of DataNodeConfigSource with the supplied configuration, or one from the pool if there is already one created for this address.