private TestSuiteExecutor createTestSuiteExecutor() { int threads; switch (threadCount) { case "none": return null; case "auto": // Can be changed in the future threads = Runtime.getRuntime().availableProcessors() + 2; break; default: if (threadCount.matches("\\d+")) { threads = Integer.parseInt(threadCount); } else if (threadCount.matches("\\d[\\d.]*[cC]")) { float multiplier = Float.parseFloat(threadCount.substring(0, threadCount.length() - 1)); threads = (int) (multiplier * Runtime.getRuntime().availableProcessors()); } else { throw new IllegalArgumentException("Incorrect thread count '" + threadCount + "'"); } break; } info("Run tests using ", threads, " threads."); return new TestSuiteExecutor(threads); }
private TestSuiteExecutor createTestSuiteExecutor() { int threads; switch (threadCount) { case "none": return null; case "auto": // Can be changed in the future threads = Runtime.getRuntime().availableProcessors() + 2; break; default: if (threadCount.matches("\\d+")) { threads = Integer.parseInt(threadCount); } else if (threadCount.matches("\\d[\\d.]*[cC]")) { float multiplier = Float.parseFloat(threadCount.substring(0, threadCount.length() - 1)); threads = (int) (multiplier * Runtime.getRuntime().availableProcessors()); } else { throw new IllegalArgumentException("Incorrect thread count '" + threadCount + "'"); } break; } info("Run tests using ", threads, " threads."); return new TestSuiteExecutor(threads); }