1.主入口
1)main方法 [class: org/openqa/selenium/grid/Main.java]
public static void main(String[] args) {
// Bruce Notes: args is required like: standalone, hub...
new Main(System.out, System.err, args).go();
}
2)调用go方法
void go() {
// It's not private to make it visible for tests
if (args.length == 0) {
showHelp(Main.class.getClassLoader());
} else {
launch(args, Main.class.getClassLoader());
}
}
3)launch方法
private void launch(String[] args, ClassLoader loader) {
String commandName = args[0];
String[] remainingArgs = new String[args.length - 1];
System.arraycopy(args, 1, remainingArgs, 0, args.length - 1);
Set<CliCommand> commands = loadCommands(loader);
CliCommand command = commands.parallelStream()
.filter(cmd -> commandName.equals(cmd.getName()))
.findFirst()
.orElse(new Help(commands));
command.configure(out, err, remainingArgs).run();
}
2.CliCommand 关系图