Source:
<code>public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadWriteAttribute(WORKER_TASK_MAX_THREADS, new WorkerReadAttributeHandler(WORKER_TASK_MAX_THREADS.getOption()), <START> new WorkerWriteAttributeHandler(ATTRIBUTES){ <END> @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.WORKER_TASK_MAX_THREADS, value.asInt()) == null; } }); resourceRegistration.registerReadWriteAttribute(WORKER_TASK_KEEPALIVE, new WorkerReadAttributeHandler(WORKER_TASK_KEEPALIVE.getOption()), new WorkerWriteAttributeHandler(ATTRIBUTES){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.WORKER_TASK_KEEPALIVE, value.asInt()) == null; } }); resourceRegistration.registerReadWriteAttribute(STACK_SIZE, new WorkerReadAttributeHandler(STACK_SIZE.getOption()), new WorkerWriteAttributeHandler(ATTRIBUTES){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.STACK_SIZE, value.asLong()) == null; } }); resourceRegistration.registerReadWriteAttribute(WORKER_IO_THREADS, new WorkerReadAttributeHandler(WORKER_IO_THREADS.getOption()), new WorkerWriteAttributeHandler(ATTRIBUTES){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.WORKER_IO_THREADS, value.asInt()) == null; } }); WorkerMetricsHandler metricsHandler = new WorkerMetricsHandler(); resourceRegistration.registerMetric(SHUTDOWN_REQUESTED, metricsHandler); resourceRegistration.registerMetric(CORE_WORKER_POOL_SIZE, metricsHandler); resourceRegistration.registerMetric(MAX_WORKER_POOL_SIZE, metricsHandler); resourceRegistration.registerMetric(IO_THREAD_COUNT, metricsHandler); resourceRegistration.registerMetric(QUEUE_SIZE, metricsHandler); }</code><technical_language>This WORKER_TASK_MAX_THREADS is a minor optimization, saving storing some irrelevant attributes in handler's attributeDefinitions map</technical_language>

Target:
public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadWriteAttribute(WORKER_TASK_MAX_THREADS, new WorkerReadAttributeHandler(WORKER_TASK_MAX_THREADS.getOption()), new WorkerWriteAttributeHandler(WORKER_TASK_MAX_THREADS){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.WORKER_TASK_MAX_THREADS, value.asInt()) == null; } }); resourceRegistration.registerReadWriteAttribute(WORKER_TASK_KEEPALIVE, new WorkerReadAttributeHandler(WORKER_TASK_KEEPALIVE.getOption()), new WorkerWriteAttributeHandler(WORKER_TASK_KEEPALIVE){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.WORKER_TASK_KEEPALIVE, value.asInt()) == null; } }); resourceRegistration.registerReadWriteAttribute(STACK_SIZE, new WorkerReadAttributeHandler(STACK_SIZE.getOption()), new WorkerWriteAttributeHandler(STACK_SIZE){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.STACK_SIZE, value.asLong()) == null; } }); resourceRegistration.registerReadWriteAttribute(WORKER_IO_THREADS, new WorkerReadAttributeHandler(WORKER_IO_THREADS.getOption()), new WorkerWriteAttributeHandler(WORKER_IO_THREADS){ @Override boolean setValue(XnioWorker worker, ModelNode value) throws IOException { return worker.setOption(Options.WORKER_IO_THREADS, value.asInt()) == null; } }); WorkerMetricsHandler metricsHandler = new WorkerMetricsHandler(); resourceRegistration.registerMetric(SHUTDOWN_REQUESTED, metricsHandler); resourceRegistration.registerMetric(CORE_WORKER_POOL_SIZE, metricsHandler); resourceRegistration.registerMetric(MAX_WORKER_POOL_SIZE, metricsHandler); resourceRegistration.registerMetric(IO_THREAD_COUNT, metricsHandler); resourceRegistration.registerMetric(QUEUE_SIZE, metricsHandler); }