Search in sources :

Example 1 with BoundedQueueThreadPoolRemove

use of org.jboss.as.threads.BoundedQueueThreadPoolRemove in project wildfly by wildfly.

the class JcaWorkManagerDefinition method registerSubModels.

static void registerSubModels(ManagementResourceRegistration resourceRegistration, boolean runtimeOnly) {
    final BoundedQueueThreadPoolAdd shortRunningThreadPoolAdd = new BoundedQueueThreadPoolAdd(false, ThreadsServices.STANDARD_THREAD_FACTORY_RESOLVER, ThreadsServices.STANDARD_HANDOFF_EXECUTOR_RESOLVER, ThreadsServices.EXECUTOR.append(WORKMANAGER_SHORT_RUNNING)) {

        @Override
        protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException {
            super.populateModel(context, operation, resource);
            context.addStep(new OperationStepHandler() {

                public void execute(OperationContext oc, ModelNode op) throws OperationFailedException {
                    checkThreadPool(oc, op, WORKMANAGER_SHORT_RUNNING);
                }
            }, MODEL);
        }
    };
    resourceRegistration.registerSubModel(new JCAThreadPoolResourceDefinition(false, runtimeOnly, WORKMANAGER_SHORT_RUNNING, ThreadsServices.EXECUTOR.append(WORKMANAGER_SHORT_RUNNING), CommonAttributes.BOUNDED_QUEUE_THREAD_POOL, shortRunningThreadPoolAdd, ReloadRequiredRemoveStepHandler.INSTANCE));
    final BoundedQueueThreadPoolAdd longRunningThreadPoolAdd = new BoundedQueueThreadPoolAdd(false, ThreadsServices.STANDARD_THREAD_FACTORY_RESOLVER, ThreadsServices.STANDARD_HANDOFF_EXECUTOR_RESOLVER, ThreadsServices.EXECUTOR.append(WORKMANAGER_LONG_RUNNING)) {

        @Override
        protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException {
            super.populateModel(context, operation, resource);
            context.addStep(new OperationStepHandler() {

                public void execute(OperationContext oc, ModelNode op) throws OperationFailedException {
                    checkThreadPool(oc, op, WORKMANAGER_LONG_RUNNING);
                }
            }, MODEL);
        }
    };
    resourceRegistration.registerSubModel(new JCAThreadPoolResourceDefinition(false, runtimeOnly, WORKMANAGER_LONG_RUNNING, ThreadsServices.EXECUTOR.append(WORKMANAGER_LONG_RUNNING), CommonAttributes.BOUNDED_QUEUE_THREAD_POOL, longRunningThreadPoolAdd, new BoundedQueueThreadPoolRemove(longRunningThreadPoolAdd)));
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) BoundedQueueThreadPoolRemove(org.jboss.as.threads.BoundedQueueThreadPoolRemove) BoundedQueueThreadPoolAdd(org.jboss.as.threads.BoundedQueueThreadPoolAdd) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) ReadResourceNameOperationStepHandler(org.jboss.as.controller.ReadResourceNameOperationStepHandler) Resource(org.jboss.as.controller.registry.Resource) OperationFailedException(org.jboss.as.controller.OperationFailedException) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

OperationContext (org.jboss.as.controller.OperationContext)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)1 ReadResourceNameOperationStepHandler (org.jboss.as.controller.ReadResourceNameOperationStepHandler)1 Resource (org.jboss.as.controller.registry.Resource)1 BoundedQueueThreadPoolAdd (org.jboss.as.threads.BoundedQueueThreadPoolAdd)1 BoundedQueueThreadPoolRemove (org.jboss.as.threads.BoundedQueueThreadPoolRemove)1 ModelNode (org.jboss.dmr.ModelNode)1