Source:
public static void main(String... args) throws InterruptedException, IOException { Options options = new Options(); Client client = new Client(options); CmdLineParser p = new CmdLineParser(options); try { p.parseArgument(args); } catch (CmdLineException e) { logger.log(Level.SEVERE, "CmdLineException occurred during parseArgument", e); p.printUsage(System.out); System.exit(-1); } logArguments(p); if (options.help) { p.printUsage(System.out); System.exit(0); } if (options.logFile != null) { logger.severe("-logFile has been deprecated. Use logging properties file syntax instead: -Djava.util.logging.config.file=" + Paths.get("").toAbsolutePath().toString() + File.separator + "logging.properties"); System.exit(-1); } if (options.pidFile != null) { String pidName = ManagementFactory.getRuntimeMXBean().getName(); String[] pidNameParts = pidName.split("@"); String pid = pidNameParts[0]; File pidFile = new File(options.pidFile); pidFile.deleteOnExit(); try { Files.write(pidFile.toPath(), pid.getBytes(UTF_8)); } catch (IOException exception) { logger.severe("Failed writing PID file: " + options.pidFile); System.exit(-1); } } if (options.passwordEnvVariable != null) { options.password = System.getenv(options.passwordEnvVariable); } if (options.password == null && options.passwordFile != null) { options.password = new String(Files.readAllBytes(Paths.get(options.passwordFile)), UTF_8).trim(); } if (options.name == null) { try { client.options.name = InetAddress.getLocalHost().getCanonicalHostName(); } catch (IOException e) { logger.severe("Failed to lookup the canonical hostname of this slave, please check system settings."); logger.severe("If not possible to resolve please specify a node name using the '-name' option"); System.exit(-1); } } SwarmClient swarmClient = new SwarmClient(options); client.run(swarmClient, args); }

Target:
public static void main(String... args) throws InterruptedException, IOException { Options options = new Options(); Client client = new Client(options); CmdLineParser p = new CmdLineParser(options); try { p.parseArgument(args); } catch (CmdLineException e) { logger.log(Level.SEVERE, "CmdLineException occurred during parseArgument", e); p.printUsage(System.out); System.exit(1); } logArguments(p); if (options.help) { p.printUsage(System.out); System.exit(0); } if (options.pidFile != null) { String pidName = ManagementFactory.getRuntimeMXBean().getName(); String[] pidNameParts = pidName.split("@"); String pid = pidNameParts[0]; File pidFile = new File(options.pidFile); pidFile.deleteOnExit(); try { Files.write(pidFile.toPath(), pid.getBytes(UTF_8)); } catch (IOException exception) { logger.severe("Failed writing PID file: " + options.pidFile); System.exit(1); } } if (options.passwordEnvVariable != null) { options.password = System.getenv(options.passwordEnvVariable); } if (options.password == null && options.passwordFile != null) { options.password = new String(Files.readAllBytes(Paths.get(options.passwordFile)), UTF_8).trim(); } if (options.name == null) { try { client.options.name = InetAddress.getLocalHost().getCanonicalHostName(); } catch (IOException e) { logger.severe("Failed to lookup the canonical hostname of this slave, please check system settings."); logger.severe("If not possible to resolve please specify a node name using the '-name' option"); System.exit(1); } } SwarmClient swarmClient = new SwarmClient(options); client.run(swarmClient, args); }