本文整理汇总了Java中org.apache.helix.model.IdealState.setResourceGroupName方法的典型用法代码示例。如果您正苦于以下问题:Java IdealState.setResourceGroupName方法的具体用法?Java IdealState.setResourceGroupName怎么用?Java IdealState.setResourceGroupName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.model.IdealState
的用法示例。
在下文中一共展示了IdealState.setResourceGroupName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIdealStateForResourceGroup
import org.apache.helix.model.IdealState; //导入方法依赖的package包/类
/**
* Create an IdealState for a resource that belongs to a resource group We use
* "resourceGroupName$resourceInstanceTag" as the IdealState znode name to differetiate different
* resources from the same resourceGroup.
*/
public IdealState createIdealStateForResourceGroup(String resourceGroupName,
String resourceTag, int numPartition, int replica, String rebalanceMode, String stateModelDefName) {
String idealStateId = genIdealStateNameWithResourceTag(resourceGroupName, resourceTag);
IdealState idealState = new IdealState(idealStateId);
idealState.setNumPartitions(numPartition);
idealState.setStateModelDefRef(stateModelDefName);
IdealState.RebalanceMode mode =
idealState.rebalanceModeFromString(rebalanceMode, IdealState.RebalanceMode.SEMI_AUTO);
idealState.setRebalanceMode(mode);
idealState.setReplicas("" + replica);
idealState.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
idealState.setResourceGroupName(resourceGroupName);
idealState.setInstanceGroupTag(resourceTag);
idealState.enableGroupRouting(true);
return idealState;
}
示例2: build
import org.apache.helix.model.IdealState; //导入方法依赖的package包/类
/**
* @return
*/
public IdealState build() {
IdealState idealstate = new IdealState(_record);
idealstate.setNumPartitions(numPartitions);
idealstate.setStateModelDefRef(stateModel);
idealstate.setStateModelFactoryName(stateModelFactoryName);
idealstate.setRebalanceMode(rebalancerMode);
idealstate.setReplicas("" + numReplica);
if (minActiveReplica >= 0) {
idealstate.setMinActiveReplicas(minActiveReplica);
}
if (rebalancerClassName != null) {
idealstate.setRebalancerClassName(rebalancerClassName);
}
if (rebalanceStrategy != null) {
idealstate.setRebalanceStrategy(rebalanceStrategy);
}
if (maxPartitionsPerNode > 0) {
idealstate.setMaxPartitionsPerInstance(maxPartitionsPerNode);
}
if (disableExternalView != null) {
idealstate.setDisableExternalView(disableExternalView);
}
if (enableGroupRouting != null) {
idealstate.enableGroupRouting(enableGroupRouting);
}
if (resourceGroupName != null) {
idealstate.setResourceGroupName(resourceGroupName);
}
if (resourceType != null) {
idealstate.setResourceType(resourceType);
}
if (rebalanceDelayInMs >= 0) {
idealstate.setRebalanceDelay(rebalanceDelayInMs);
}
if (delayRebalanceEnabled != null) {
idealstate.setDelayRebalanceEnabled(delayRebalanceEnabled);
}
if (!idealstate.isValid()) {
throw new HelixException("invalid ideal-state: " + idealstate);
}
return idealstate;
}