@Override protected SimulatorOperation newOperation() { int count = options.valueOf(countSpec); if (count <= 0) { throw new CommandLineExitException("--count can't be smaller than 1"); } LOGGER.info(format("Starting %s workers", count)); String hzConfig = null; if (options.has(configSpec)) { hzConfig = fileAsText(options.valueOf(configSpec)); } return new RcWorkerStartOperation() .setCount(count) .setVersionSpec(options.valueOf(versionSpecSpec)) .setWorkerType(options.valueOf(workerTypeSpec)) .setHzConfig(hzConfig) .setVmOptions(options.valueOf(vmOptionsSpec)) .setAgentAddresses(loadAddresses(options, agentsSpec, AddressLevel.AGENT)) .setTags(TagUtils.loadTags(options, tagsSpec)) .setAgentTags(TagUtils.loadTags(options, agentsTags)); }
WorkerQuery newQuery() { WorkerQuery query = new WorkerQuery().setRandom(options.has(randomSpec)); List<String> workerAddresses = loadAddresses(options, workersSpec, AddressLevel.WORKER); if (workerAddresses == null) { List<String> agentAddresses = loadAddresses(options, agentsSpec, AddressLevel.AGENT); Integer maxCount = options.valueOf(maxCountSpec); if (maxCount != null) { if (maxCount <= 0) { throw new CommandLineExitException("--maxCount can't be smaller than 1"); } } return query .setAgentAddresses(agentAddresses) .setWorkerType(options.valueOf(workerTypeSpec)) .setVersionSpec(options.valueOf(versionSpecSpec)) .setWorkerTags(TagUtils.loadTags(options, workerTagsSpec)) .setMaxCount(maxCount); } else { return query.setWorkerAddresses(workerAddresses); } }