private String[] buildArgs(WorkerJvm workerJvm, WorkerType type) { List<String> args = new LinkedList<String>(); int workerIndex = workerJvmSettings.getWorkerIndex(); int workerPort = agent.getPort() + workerIndex; addNumaCtlSettings(args); addProfilerSettings(workerJvm, args); args.add("-classpath"); args.add(getClasspath()); args.addAll(getJvmOptions()); args.add("-XX:OnOutOfMemoryError=\"touch worker.oome\""); args.add("-Dhazelcast.logging.type=log4j"); args.add("-Dlog4j.configuration=file:" + log4jFile.getAbsolutePath()); args.add("-DSIMULATOR_HOME=" + getSimulatorHome()); args.add("-DworkerId=" + workerJvm.getId()); args.add("-DworkerType=" + type); args.add("-DpublicAddress=" + agent.getPublicAddress()); args.add("-DagentIndex=" + agent.getAddressIndex()); args.add("-DworkerIndex=" + workerIndex); args.add("-DworkerPort=" + workerPort); args.add("-DautoCreateHzInstance=" + workerJvmSettings.isAutoCreateHzInstance()); args.add( "-DworkerPerformanceMonitorIntervalSeconds=" + workerJvmSettings.getWorkerPerformanceMonitorIntervalSeconds()); args.add("-DhzConfigFile=" + hzConfigFile.getAbsolutePath()); // add class name to start correct worker type args.add(type.getClassName()); return args.toArray(new String[args.size()]); }