本文整理汇总了Java中org.apache.helix.HelixManager.getClusterManagmentTool方法的典型用法代码示例。如果您正苦于以下问题:Java HelixManager.getClusterManagmentTool方法的具体用法?Java HelixManager.getClusterManagmentTool怎么用?Java HelixManager.getClusterManagmentTool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.HelixManager
的用法示例。
在下文中一共展示了HelixManager.getClusterManagmentTool方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstanceToTopicPartitionsMap
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
/**
* From IdealStates.
*
* @return InstanceToNumTopicPartitionMap
*/
public static Map<String, Set<TopicPartition>> getInstanceToTopicPartitionsMap(
HelixManager helixManager) {
Map<String, Set<TopicPartition>> instanceToNumTopicPartitionMap =
new HashMap<String, Set<TopicPartition>>();
HelixAdmin helixAdmin = helixManager.getClusterManagmentTool();
String helixClusterName = helixManager.getClusterName();
for (String topic : helixAdmin.getResourcesInCluster(helixClusterName)) {
IdealState is = helixAdmin.getResourceIdealState(helixClusterName, topic);
for (String partition : is.getPartitionSet()) {
TopicPartition tpi = new TopicPartition(topic, Integer.parseInt(partition));
for (String instance : is.getInstanceSet(partition)) {
if (!instanceToNumTopicPartitionMap.containsKey(instance)) {
instanceToNumTopicPartitionMap.put(instance, new HashSet<TopicPartition>());
}
instanceToNumTopicPartitionMap.get(instance).add(tpi);
}
}
}
return instanceToNumTopicPartitionMap;
}
示例2: getUnassignedPartitions
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
public static Set<TopicPartition> getUnassignedPartitions(HelixManager helixManager) {
Set<TopicPartition> unassignedPartitions = new HashSet<TopicPartition>();
HelixAdmin helixAdmin = helixManager.getClusterManagmentTool();
String helixClusterName = helixManager.getClusterName();
for (String topic : helixAdmin.getResourcesInCluster(helixClusterName)) {
IdealState is = helixAdmin.getResourceIdealState(helixClusterName, topic);
int numPartitions = is.getNumPartitions();
for (int partition = 0; partition < numPartitions; ++partition) {
if (is.getInstanceSet(Integer.toString(partition)).isEmpty()) {
TopicPartition tpi = new TopicPartition(topic, partition);
unassignedPartitions.add(tpi);
}
}
}
return unassignedPartitions;
}
示例3: getInstanceToTopicPartitionsMap
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
/**
* From IdealStates.
* @param helixManager
* @return InstanceToNumTopicPartitionMap
*/
public static Map<String, Set<TopicPartition>> getInstanceToTopicPartitionsMap(
HelixManager helixManager) {
Map<String, Set<TopicPartition>> instanceToNumTopicPartitionMap =
new HashMap<String, Set<TopicPartition>>();
HelixAdmin helixAdmin = helixManager.getClusterManagmentTool();
String helixClusterName = helixManager.getClusterName();
for (String topic : helixAdmin.getResourcesInCluster(helixClusterName)) {
IdealState is = helixAdmin.getResourceIdealState(helixClusterName, topic);
for (String partition : is.getPartitionSet()) {
TopicPartition tpi = new TopicPartition(topic, Integer.parseInt(partition));
for (String instance : is.getInstanceSet(partition)) {
if (!instanceToNumTopicPartitionMap.containsKey(instance)) {
instanceToNumTopicPartitionMap.put(instance, new HashSet<TopicPartition>());
}
instanceToNumTopicPartitionMap.get(instance).add(tpi);
}
}
}
return instanceToNumTopicPartitionMap;
}
示例4: ParticipantManager
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
public ParticipantManager(HelixManager manager, ZkClient zkclient, int sessionTimeout,
LiveInstanceInfoProvider liveInstanceInfoProvider, List<PreConnectCallback> preConnectCallbacks) {
_zkclient = zkclient;
_manager = manager;
_clusterName = manager.getClusterName();
_instanceName = manager.getInstanceName();
_keyBuilder = new PropertyKey.Builder(_clusterName);
_sessionId = manager.getSessionId();
_sessionTimeout = sessionTimeout;
_configAccessor = manager.getConfigAccessor();
_instanceType = manager.getInstanceType();
_helixAdmin = manager.getClusterManagmentTool();
_dataAccessor = (ZKHelixDataAccessor) manager.getHelixDataAccessor();
_messagingService = (DefaultMessagingService) manager.getMessagingService();
_stateMachineEngine = manager.getStateMachineEngine();
_liveInstanceInfoProvider = liveInstanceInfoProvider;
_preConnectCallbacks = preConnectCallbacks;
}
示例5: assignIdealStates
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
private static void assignIdealStates(HelixManager helixManager,
Map<String, IdealState> idealStatesFromAssignment) {
HelixAdmin helixAdmin = helixManager.getClusterManagmentTool();
String helixClusterName = helixManager.getClusterName();
for (String topic : idealStatesFromAssignment.keySet()) {
IdealState idealState = idealStatesFromAssignment.get(topic);
helixAdmin.setResourceIdealState(helixClusterName, topic, idealState);
}
}
示例6: BrokerResourceOnlineOfflineStateModelFactory
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
public BrokerResourceOnlineOfflineStateModelFactory(HelixManager helixManager,
ZkHelixPropertyStore<ZNRecord> propertyStore, HelixExternalViewBasedRouting helixExternalViewBasedRouting) {
_helixManager = helixManager;
_propertyStore = propertyStore;
_helixAdmin = helixManager.getClusterManagmentTool();
_helixExternalViewBasedRouting = helixExternalViewBasedRouting;
}
示例7: RealtimeResourceStateTransitionHandler
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
public RealtimeResourceStateTransitionHandler(HelixManager manager) {
this.manager = manager;
helixAdmin = manager.getClusterManagmentTool();
realtimeSegmentManagerMap = new HashMap<String, KafkaRealtimeSegmentDataManager>();
}
示例8: GobblinHelixTaskDriver
import org.apache.helix.HelixManager; //导入方法依赖的package包/类
public GobblinHelixTaskDriver(HelixManager manager) {
this(manager.getClusterManagmentTool(), manager.getHelixDataAccessor(), manager
.getConfigAccessor(), manager.getHelixPropertyStore(), manager.getClusterName());
}