资源简介
zookeeper-3.4.5-cdh5.5.0.tar.gz
代码片段和文件信息
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License Version 2.0 (the
* “License“); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.zookeeper.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
/**
* This is a generic Main class that is completely driven by the
* /mainClasses resource on the class path. This resource has the
* format:
*
* cmd:mainClass:Description
*
* Any lines starting with # will be skipped
*
*/
public class FatJarMain {
static class Cmd {
Cmd(String cmd String clazz String desc) {
this.cmd = cmd;
this.clazz = clazz;
this.desc = desc;
}
String cmd;
String clazz;
String desc;
}
static HashMap cmds = new HashMap();
static ArrayList order = new ArrayList();
/**
* @param args the first parameter of args will be used as an
* index into the /mainClasses resource. The rest will be passed
* to the mainClass to run.
* @throws IOException
* @throws ClassNotFoundException
* @throws NoSuchMethodException
* @throws SecurityException
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/
public static void main(String[] args) throws IOException ClassNotFoundException SecurityException NoSuchMethodException IllegalArgumentException IllegalAccessException {
InputStream is = FatJarMain.class.getResourceAsStream(“/mainClasses“);
if (is == null) {
System.err.println(“Couldn‘t find /mainClasses in classpath.“);
System.exit(3);
}
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while((line = br.readLine()) != null) {
String parts[] = line.split(“:“ 3);
if (parts.length != 3 || (parts[0].length() > 0 && parts[0].charAt(0) == ‘#‘)) {
continue;
}
if (parts[0].length() > 0) {
cmds.put(parts[0] new Cmd(parts[0] parts[1] parts[2]));
- 上一篇:现代通信原理与技术
- 下一篇:视觉显著性检测MSRA1000数据集,即ASD数据集
相关资源
- CDHD《用户手册》版本5.0.pdf
- zookeeper+redis高可用完整.zip
- zookeeper+redis高可用完整
- zookeeper3.4.13
- zookeeper-3.3.6
- 安装zookeeper-3.4.5
- zookeeper-3.4.8.tar.gz
- dubbo+zookeeper入门资源
- zookeeper-3.4.5-cdh5.10.0.tar.gz
- zookeeper-3.4.6 下载151871
- zookeeper-3.4.6
- zookeeper-3.4.5.tar.gz178819
- zookeeper 分布式实践
- 从Paxos到Zookeeper分布式一致性原理与实
- Cloudera Administrator Training
- zookeeper-3.4.5.tar.gz
- zookeeper-3.4.10 64位 Windows服务版
- zookeeper-3.4.8解压即用低分版
- 从Paxos到Zookeeper++分布式一致性原理与
- dubbo zookeeper demo
- zookeeper插件
- hadoop-2.5.0-cdh5.3.6的native包-含snappy
- Cloudera CDH集群运维手册
- Protege-5.5.0-windows.zip
- hue-3.9.0-cdh5.5.0.tar.gz
- vmware-viclient-all-5.5.0-1281650.part5.rar
-
hba
se-1.2.0-cdh5.10.0.tar.gz - servotronix高创伺服调试软件ServoStudio
- eclipse 中实现dubbo provider、customer源代
- hadoop-2.6.0-cdh5.10.0.tar.gz
评论
共有 条评论