Source:
private void run(int slaveIndex) throws Exception { log.debugf("Started with UUID %s", ArgsHolder.getUuid()); InetAddress address = connection.connectToMaster(slaveIndex); state.setSlaveIndex(connection.receiveSlaveIndex()); log.info("Received slave index " + state.getSlaveIndex()); state.setMaxClusterSize(connection.receiveSlaveCount()); log.info("Received slave count " + state.getMaxClusterSize()); state.setLocalAddress(address); while (true) { Object object = connection.receiveObject(); log.trace("Received " + object); if (object == null) { log.info("Master shutdown!"); break; } else if (object instanceof ArrayList) { state.setSlaveAddressList((List<InetSocketAddress>) object); } else if (object instanceof RemoteSlaveConnection.Restart) { UUID nextUuid = UUID.randomUUID(); Configuration.Setup setup = configuration.getSetup(cluster.getGroup(state.getSlaveIndex()).name); VmArgs vmArgs = new VmArgs(); PropertyHelper.setPropertiesFromDefinitions(vmArgs, setup.getVmArgs(), getCurrentExtras(configuration, cluster)); HashMap<String, String> envs = new HashMap<>(); for (Map.Entry<String, Definition> entry : setup.getEnvironment().entrySet()) { envs.put(entry.getKey(), Evaluator.parseString(entry.getValue().toString())); } RestartHelper.spawnSlave(state.getSlaveIndex(), nextUuid, setup.plugin, vmArgs, envs); connection.sendResponse(null, nextUuid); connection.release(); ShutDownHook.exit(0); } else if (object instanceof Scenario) { scenario = (Scenario) object; ScenarioRunner runner = new ScenarioRunner(); runner.start(); runner.join(); runCleanup(); } else if (object instanceof Configuration) { configuration = (Configuration) object; state.setConfigName(configuration.name); } else if (object instanceof Cluster) { cluster = (Cluster) object; } else if (object instanceof Timeline.Request) { connection.sendResponse(state.getTimeline(), null); } } ShutDownHook.exit(0); }

Target:
private void run(int slaveIndex) throws Exception { log.debugf("Started with UUID %s", ArgsHolder.getUuid()); InetAddress address = connection.connectToMaster(slaveIndex); state.setSlaveIndex(connection.receiveSlaveIndex()); log.info("Received slave index " + state.getSlaveIndex()); state.setMaxClusterSize(connection.receiveSlaveCount()); log.info("Received slave count " + state.getMaxClusterSize()); state.setLocalAddress(address); while (true) { Object object = connection.receiveObject(); log.trace("Received " + object); if (object == null) { log.info("Master shutdown!"); break; } else if (object instanceof RemoteSlaveConnection.Restart) { UUID nextUuid = UUID.randomUUID(); Configuration.Setup setup = configuration.getSetup(cluster.getGroup(state.getSlaveIndex()).name); VmArgs vmArgs = new VmArgs(); PropertyHelper.setPropertiesFromDefinitions(vmArgs, setup.getVmArgs(), getCurrentExtras(configuration, cluster)); HashMap<String, String> envs = new HashMap<>(); for (Map.Entry<String, Definition> entry : setup.getEnvironment().entrySet()) { envs.put(entry.getKey(), Evaluator.parseString(entry.getValue().toString())); } RestartHelper.spawnSlave(state.getSlaveIndex(), nextUuid, setup.plugin, vmArgs, envs); connection.sendObject(null, nextUuid); connection.release(); ShutDownHook.exit(0); } else if (object instanceof Scenario) { scenario = (Scenario) object; ScenarioRunner runner = new ScenarioRunner(); runner.start(); runner.join(); runCleanup(); } else if (object instanceof Configuration) { configuration = (Configuration) object; state.setConfigName(configuration.name); } else if (object instanceof Cluster) { cluster = (Cluster) object; } else if (object instanceof Timeline.Request) { connection.sendObject(state.getTimeline(), null); } else if (object instanceof SlaveConnectionInfo.Request) { connection.sendObject(Utils.getSlaveConnectionInfo(state.getSlaveIndex()), null); } else if (object instanceof RemoteSlaveConnection.SlaveAddresses) { state.setSlaveAddresses((RemoteSlaveConnection.SlaveAddresses) object); } } ShutDownHook.exit(0); }