HDFS-11238. Fix checkstyle warnings in NameNode#createNameNode. Contributed by Ethan Li.

This commit is contained in:
Akira Ajisaka 2017-02-15 16:53:50 +09:00
parent 1e11080b78
commit 8acb376c9c

View File

@ -1579,62 +1579,53 @@ public static NameNode createNameNode(String argv[], Configuration conf)
} }
setStartupOption(conf, startOpt); setStartupOption(conf, startOpt);
boolean aborted = false;
switch (startOpt) { switch (startOpt) {
case FORMAT: { case FORMAT:
boolean aborted = format(conf, startOpt.getForceFormat(), aborted = format(conf, startOpt.getForceFormat(),
startOpt.getInteractiveFormat()); startOpt.getInteractiveFormat());
terminate(aborted ? 1 : 0); terminate(aborted ? 1 : 0);
return null; // avoid javac warning return null; // avoid javac warning
} case GENCLUSTERID:
case GENCLUSTERID: { System.err.println("Generating new cluster id:");
System.err.println("Generating new cluster id:"); System.out.println(NNStorage.newClusterID());
System.out.println(NNStorage.newClusterID()); terminate(0);
terminate(0); return null;
return null; case ROLLBACK:
} aborted = doRollback(conf, true);
case ROLLBACK: { terminate(aborted ? 1 : 0);
boolean aborted = doRollback(conf, true); return null; // avoid warning
terminate(aborted ? 1 : 0); case BOOTSTRAPSTANDBY:
return null; // avoid warning String[] toolArgs = Arrays.copyOfRange(argv, 1, argv.length);
} int rc = BootstrapStandby.run(toolArgs, conf);
case BOOTSTRAPSTANDBY: { terminate(rc);
String toolArgs[] = Arrays.copyOfRange(argv, 1, argv.length); return null; // avoid warning
int rc = BootstrapStandby.run(toolArgs, conf); case INITIALIZESHAREDEDITS:
terminate(rc); aborted = initializeSharedEdits(conf,
return null; // avoid warning startOpt.getForceFormat(),
} startOpt.getInteractiveFormat());
case INITIALIZESHAREDEDITS: { terminate(aborted ? 1 : 0);
boolean aborted = initializeSharedEdits(conf, return null; // avoid warning
startOpt.getForceFormat(), case BACKUP:
startOpt.getInteractiveFormat()); case CHECKPOINT:
terminate(aborted ? 1 : 0); NamenodeRole role = startOpt.toNodeRole();
return null; // avoid warning DefaultMetricsSystem.initialize(role.toString().replace(" ", ""));
} return new BackupNode(conf, role);
case BACKUP: case RECOVER:
case CHECKPOINT: { NameNode.doRecovery(startOpt, conf);
NamenodeRole role = startOpt.toNodeRole(); return null;
DefaultMetricsSystem.initialize(role.toString().replace(" ", "")); case METADATAVERSION:
return new BackupNode(conf, role); printMetadataVersion(conf);
} terminate(0);
case RECOVER: { return null; // avoid javac warning
NameNode.doRecovery(startOpt, conf); case UPGRADEONLY:
return null; DefaultMetricsSystem.initialize("NameNode");
} new NameNode(conf);
case METADATAVERSION: { terminate(0);
printMetadataVersion(conf); return null;
terminate(0); default:
return null; // avoid javac warning DefaultMetricsSystem.initialize("NameNode");
} return new NameNode(conf);
case UPGRADEONLY: {
DefaultMetricsSystem.initialize("NameNode");
new NameNode(conf);
terminate(0);
return null;
}
default: {
DefaultMetricsSystem.initialize("NameNode");
return new NameNode(conf);
}
} }
} }