Source:
NioXnioWorker(final NioXnio xnio, final ThreadGroup threadGroup, final OptionMap optionMap, final Runnable terminationTask) throws IOException { super(xnio, threadGroup, optionMap, terminationTask); final int threadCount; if (optionMap.contains(Options.WORKER_IO_THREADS)) { threadCount = optionMap.get(Options.WORKER_IO_THREADS, 0); } else { threadCount = Math.max(optionMap.get(Options.WORKER_READ_THREADS, 1), optionMap.get(Options.WORKER_WRITE_THREADS, 1)); } if (threadCount < 0) { throw log.optionOutOfRange("WORKER_IO_THREADS"); } final long workerStackSize = optionMap.get(Options.STACK_SIZE, 0L); if (workerStackSize < 0L) { throw log.optionOutOfRange("STACK_SIZE"); } final String workerName = getName(); WorkerThread[] workerThreads; workerThreads = new WorkerThread[threadCount]; final boolean markWorkerThreadAsDaemon = optionMap.get(Options.THREAD_DAEMON, false); boolean ok = false; try { for (int i = 0; i < threadCount; i++) { final WorkerThread workerThread = new WorkerThread(this, xnio.mainSelectorCreator.open(), String.format("%s I/O-%d", workerName, Integer.valueOf(i + 1)), threadGroup, workerStackSize, i); if (markWorkerThreadAsDaemon) { workerThread.setDaemon(true); } workerThreads[i] = workerThread; } acceptThread = new WorkerThread(this, xnio.mainSelectorCreator.open(), String.format("%s Accept", workerName), threadGroup, workerStackSize, threadCount); if (markWorkerThreadAsDaemon) { acceptThread.setDaemon(true); } ok = true; } finally { if (! ok) { for (WorkerThread worker : workerThreads) { if (worker != null) safeClose(worker.getSelector()); } } } this.workerThreads = workerThreads; this.metrics = new NioWorkerMatrics(workerName); metrics.register(); }

Target:
NioXnioWorker(final NioXnio xnio, final ThreadGroup threadGroup, final OptionMap optionMap, final Runnable terminationTask) throws IOException { super(xnio, threadGroup, optionMap, terminationTask); final int threadCount; if (optionMap.contains(Options.WORKER_IO_THREADS)) { threadCount = optionMap.get(Options.WORKER_IO_THREADS, 0); } else { threadCount = Math.max(optionMap.get(Options.WORKER_READ_THREADS, 1), optionMap.get(Options.WORKER_WRITE_THREADS, 1)); } if (threadCount < 0) { throw log.optionOutOfRange("WORKER_IO_THREADS"); } this.workerStackSize = optionMap.get(Options.STACK_SIZE, 0L); if (workerStackSize < 0L) { throw log.optionOutOfRange("STACK_SIZE"); } final String workerName = getName(); WorkerThread[] workerThreads; workerThreads = new WorkerThread[threadCount]; final boolean markWorkerThreadAsDaemon = optionMap.get(Options.THREAD_DAEMON, false); boolean ok = false; try { for (int i = 0; i < threadCount; i++) { final WorkerThread workerThread = new WorkerThread(this, xnio.mainSelectorCreator.open(), String.format("%s I/O-%d", workerName, Integer.valueOf(i + 1)), threadGroup, workerStackSize, i); if (markWorkerThreadAsDaemon) { workerThread.setDaemon(true); } workerThreads[i] = workerThread; } acceptThread = new WorkerThread(this, xnio.mainSelectorCreator.open(), String.format("%s Accept", workerName), threadGroup, workerStackSize, threadCount); if (markWorkerThreadAsDaemon) { acceptThread.setDaemon(true); } ok = true; } finally { if (! ok) { for (WorkerThread worker : workerThreads) { if (worker != null) safeClose(worker.getSelector()); } } } this.workerThreads = workerThreads; this.metrics = new NioWorkerMetrics(workerName); metrics.register(); }