本文整理汇总了Java中org.apache.helix.HelixAdmin.close方法的典型用法代码示例。如果您正苦于以下问题:Java HelixAdmin.close方法的具体用法?Java HelixAdmin.close怎么用?Java HelixAdmin.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.HelixAdmin
的用法示例。
在下文中一共展示了HelixAdmin.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.helix.HelixAdmin; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
if (args.length != 3) {
System.out.println("USAGE: MySQLAgentLauncher zkAddress clusterName instanceName");
}
String zkAddress = args[0];
String clusterName = args[1];
String instanceName = args[2];
HelixAdmin admin = new ZKHelixAdmin(zkAddress);
List<String> clusters = admin.getClusters();
System.out.println(clusters);
if (!clusters.contains(clusterName)) {
System.err.println("Cluster is not setup. Use cluster-admin to create a new cluster");
System.exit(1);
}
InstanceConfig instanceConfig = admin.getInstanceConfig(clusterName, instanceName);
if (instanceConfig == null) {
String msg =
"Agent is not yet configured in the cluster. Use cluster-admin to first configure the new Mysql Agent";
System.err.println(msg);
System.exit(1);
}
admin.close();
MySQLAgent agent = new MySQLAgent(zkAddress, clusterName, instanceConfig);
agent.start();
Thread.currentThread().join();
}
示例2: validateAndClose
import org.apache.helix.HelixAdmin; //导入方法依赖的package包/类
/**
* Validate that the information in Helix is consistent with the information in the static clustermap; and close
* all the admin connections to ZK hosts.
*/
private void validateAndClose() throws Exception {
try {
verifyEquivalencyWithStaticClusterMap(staticClusterMap.hardwareLayout, staticClusterMap.partitionLayout);
} finally {
for (HelixAdmin admin : adminForDc.values()) {
admin.close();
}
}
}