Package com.github.ambry.clustermap
Class HelixFactory
- java.lang.Object
-
- com.github.ambry.clustermap.HelixFactory
-
public class HelixFactory extends java.lang.Object
A factory class to construct and get a reference to aHelixManager
-
-
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 aHelixManager
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 aHelixManager
and connect to it, if not already connected
-
-
-
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 aHelixManager
- 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
- theInstanceType
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 aHelixManager
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
- theInstanceType
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
- theClusterMapConfig
to use.zkAddr
- the ZooKeeper address to connect to. If aHelixManager
is required and one is already in the pool with this address, it will be reused.metrics
- theDataNodeConfigSourceMetrics
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.
-
-