System.exit(0);
}
private static MasterAddress parseArgs(String[] args)
{
MasterAddress ma = new MasterAddress();
if (args.length < 2)
return null;
for (int i = 0; i < args.length; i++)
{
String s = args[i];
if (s.equalsIgnoreCase("-h"))
{
String host = "";
try
{
host = args[i+1];
ma.setIp(host);
}
catch(Exception e)
{
printUsageAndExit(String.format("host:[%s] is incorrect", host));
}
}
if (s.equalsIgnoreCase("-p"))
{
String port="";
try
{
port = args[i + 1];
Integer.valueOf(port);
ma.setPort(port);
}
catch(Exception e)
{
printUsageAndExit(String.format("port:[%s] is incorrect", port));
}
}
if (s.equalsIgnoreCase("-s"))
{
String serv="";
try
{
serv = args[i+1];
ma.setName(serv);
}
catch(Exception e)
{
printUsageAndExit(String.format("service:[%s] is incorrect", serv));
}