Examples of BoundedOperationParameters


Examples of org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedOperationParameters

        for(final AttributeDefinition attribute : ATTRIBUTES) {
            attribute.resolveModelAttribute(context, model);
        }

        final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils.parseBoundedThreadPoolOperationParameters(operation);

        ServiceTarget target = context.getServiceTarget();
        final int coreThreads =  params.getCoreThreads() == null ? params.getMaxThreads().getScaledCount() : params.getCoreThreads().getScaledCount();
        final ServiceName serviceName = ThreadsServices.executorName(params.getName());
        final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService(
                coreThreads,
                params.getMaxThreads().getScaledCount(),
                params.getQueueLength().getScaledCount(),
                params.isBlocking(),
                params.getKeepAliveTime(),
                params.isAllowCoreTimeout());

        //TODO add the handoffExceutor injection

        final ServiceBuilder<ManagedQueueExecutorService> serviceBuilder = target.addService(serviceName, service);
        ThreadsSubsystemThreadPoolOperationUtils.addThreadFactoryDependency(params.getThreadFactory(), serviceName, serviceBuilder, service.getThreadFactoryInjector(), target, params.getName() + "-threads");
        serviceBuilder.addListener(verificationHandler);
        serviceBuilder.install();
    }
View Full Code Here

Examples of org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedOperationParameters

    static final OperationHandler INSTANCE = new BoundedQueueThreadPoolAdd();

    @Override
    public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) {
        final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils.parseBoundedThreadPoolOperationParameters(operation);

        //Apply to the model
        final ModelNode model = context.getSubModel();
        model.get(NAME).set(params.getName());
        if (params.getThreadFactory() != null) {
            model.get(THREAD_FACTORY).set(params.getThreadFactory());
        }
        if (params.getProperties() != null && params.getProperties().asList().size() > 0) {
            model.get(PROPERTIES).set(params.getProperties());
        }
        if (params.getMaxThreads() != null) {
            model.get(MAX_THREADS).set(operation.get(MAX_THREADS));
        }
        if (params.getKeepAliveTime() != null) {
            model.get(KEEPALIVE_TIME).set(operation.get(KEEPALIVE_TIME));
        }

        model.get(BLOCKING).set(params.isBlocking());
        if (params.getHandoffExecutor() != null) {
            model.get(HANDOFF_EXECUTOR).set(params.getHandoffExecutor());
        }
        model.get(ALLOW_CORE_TIMEOUT).set(params.isAllowCoreTimeout());
        if (params.getQueueLength() != null) {
            model.get(QUEUE_LENGTH).set(operation.get(QUEUE_LENGTH));
        }

        if (params.getCoreThreads() != null) {
            model.get(CORE_THREADS).set(operation.get(CORE_THREADS));
        }

        // Compensating is remove
        final ModelNode compensating = Util.getResourceRemoveOperation(params.getAddress());

        if (context.getRuntimeContext() != null) {
            context.getRuntimeContext().setRuntimeTask(new RuntimeTask() {
                public void execute(RuntimeTaskContext context) throws OperationFailedException {
                    ServiceTarget target = context.getServiceTarget();
                    final ServiceName serviceName = ThreadsServices.executorName(params.getName());
                    final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService(
                            params.getCoreThreads().getScaledCount(),
                            params.getMaxThreads().getScaledCount(),
                            params.getQueueLength().getScaledCount(),
                            params.isBlocking(),
                            params.getKeepAliveTime(),
                            params.isAllowCoreTimeout());

                    //TODO add the handoffExceutor injection

                    final ServiceBuilder<Executor> serviceBuilder = target.addService(serviceName, service);
                    ThreadsSubsystemThreadPoolOperationUtils.addThreadFactoryDependency(params.getThreadFactory(), serviceName, serviceBuilder, service.getThreadFactoryInjector(), target, params.getName() + "-threads");
                    serviceBuilder.install();
                    resultHandler.handleResultComplete();
                }
            });
        } else {
View Full Code Here

Examples of org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedOperationParameters

        resolved.get(OP_ADDR).set(operation.get(OP_ADDR));
        for(final AttributeDefinition attribute : ATTRIBUTES) {
            resolved.get(attribute.getName()).set(attribute.resolveModelAttribute(context, model));
        }

        final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils.parseBoundedThreadPoolOperationParameters(resolved);

        ServiceTarget target = context.getServiceTarget();
        final int coreThreads =  params.getCoreThreads() == null ? params.getMaxThreads().getScaledCount() : params.getCoreThreads().getScaledCount();
        final ServiceName serviceName = ThreadsServices.executorName(params.getName());
        final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService(
                coreThreads,
                params.getMaxThreads().getScaledCount(),
                params.getQueueLength().getScaledCount(),
                params.isBlocking(),
                params.getKeepAliveTime(),
                params.isAllowCoreTimeout());

        //TODO add the handoffExceutor injection

        final ServiceBuilder<ManagedQueueExecutorService> serviceBuilder = target.addService(serviceName, service);
        ThreadsSubsystemThreadPoolOperationUtils.addThreadFactoryDependency(params.getThreadFactory(), serviceName, serviceBuilder, service.getThreadFactoryInjector(), target, params.getName() + "-threads");

        if (verificationHandler != null) {
            serviceBuilder.addListener(verificationHandler);
        }
        ServiceController<?> sc = serviceBuilder.install();
View Full Code Here

Examples of org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedOperationParameters

    /**
     * {@inheritDoc}
     */
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils.parseBoundedThreadPoolOperationParameters(operation);

        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();

        //Apply to the model
        final ModelNode model = context.readModelForUpdate(PathAddress.EMPTY_ADDRESS);
        model.get(NAME).set(name);
        if (params.getThreadFactory() != null) {
            model.get(THREAD_FACTORY).set(params.getThreadFactory());
        }
        if (params.getProperties() != null && params.getProperties().asList().size() > 0) {
            model.get(PROPERTIES).set(params.getProperties());
        }
        if (params.getMaxThreads() != null) {
            model.get(MAX_THREADS).set(operation.get(MAX_THREADS));
        }

        if (params.getKeepAliveTime() != null) {
            model.get(KEEPALIVE_TIME).set(operation.get(KEEPALIVE_TIME));
        }

        model.get(BLOCKING).set(params.isBlocking());
        if (params.getHandoffExecutor() != null) {
            model.get(HANDOFF_EXECUTOR).set(params.getHandoffExecutor());
        }
        model.get(ALLOW_CORE_TIMEOUT).set(params.isAllowCoreTimeout());
        if (params.getQueueLength() != null) {
            model.get(QUEUE_LENGTH).set(operation.get(QUEUE_LENGTH));
        } else {
            throw new OperationFailedException(new ModelNode().set("Parameter " + QUEUE_LENGTH + " may not be null."));
        }

        if (params.getCoreThreads() != null) {
            model.get(CORE_THREADS).set(operation.get(CORE_THREADS));
        }

        if (context.getType() == OperationContext.Type.SERVER) {
            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) {
                    final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
                    ServiceTarget target = context.getServiceTarget();
                    final int coreThreads =  params.getCoreThreads() == null ? params.getMaxThreads().getScaledCount() : params.getCoreThreads().getScaledCount();
                    final ServiceName serviceName = ThreadsServices.executorName(params.getName());
                    final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService(
                            coreThreads,
                            params.getMaxThreads().getScaledCount(),
                            params.getQueueLength().getScaledCount(),
                            params.isBlocking(),
                            params.getKeepAliveTime(),
                            params.isAllowCoreTimeout());

                    //TODO add the handoffExceutor injection

                    final ServiceBuilder<ExecutorService> serviceBuilder = target.addService(serviceName, service);
                    ThreadsSubsystemThreadPoolOperationUtils.addThreadFactoryDependency(params.getThreadFactory(), serviceName, serviceBuilder, service.getThreadFactoryInjector(), target, params.getName() + "-threads");
                    serviceBuilder.addListener(verificationHandler);
                    serviceBuilder.install();

                    context.addStep(verificationHandler, OperationContext.Stage.VERIFY);

View Full Code Here

Examples of org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedOperationParameters

    /**
     * {@inheritDoc}
     */
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils.parseBoundedThreadPoolOperationParameters(operation);

        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();

        //Apply to the model
        final ModelNode model = context.readModelForUpdate(PathAddress.EMPTY_ADDRESS);
        model.get(NAME).set(name);
        if (params.getThreadFactory() != null) {
            model.get(THREAD_FACTORY).set(params.getThreadFactory());
        }
        if (params.getProperties() != null && params.getProperties().asList().size() > 0) {
            model.get(PROPERTIES).set(params.getProperties());
        }
        if (params.getMaxThreads() != null) {
            model.get(MAX_THREADS).set(operation.get(MAX_THREADS));
        }

        if (params.getKeepAliveTime() != null) {
            model.get(KEEPALIVE_TIME).set(operation.get(KEEPALIVE_TIME));
        }

        model.get(BLOCKING).set(params.isBlocking());
        if (params.getHandoffExecutor() != null) {
            model.get(HANDOFF_EXECUTOR).set(params.getHandoffExecutor());
        }
        model.get(ALLOW_CORE_TIMEOUT).set(params.isAllowCoreTimeout());
        if (params.getQueueLength() != null) {
            model.get(QUEUE_LENGTH).set(operation.get(QUEUE_LENGTH));
        } else {
            throw new OperationFailedException(new ModelNode().set("Parameter " + QUEUE_LENGTH + " may not be null "));
        }

        if (params.getCoreThreads() != null) {
            model.get(CORE_THREADS).set(operation.get(CORE_THREADS));
        }

        if (context.getType() == OperationContext.Type.SERVER) {
            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) {
                    final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
                    ServiceTarget target = context.getServiceTarget();
                    final int coreThreads =  params.getCoreThreads() == null ? params.getMaxThreads().getScaledCount() : params.getCoreThreads().getScaledCount();
                    final ServiceName serviceName = ThreadsServices.executorName(params.getName());
                    final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService(
                            coreThreads,
                            params.getMaxThreads().getScaledCount(),
                            params.getQueueLength().getScaledCount(),
                            params.isBlocking(),
                            params.getKeepAliveTime(),
                            params.isAllowCoreTimeout());

                    //TODO add the handoffExceutor injection

                    final ServiceBuilder<Executor> serviceBuilder = target.addService(serviceName, service);
                    ThreadsSubsystemThreadPoolOperationUtils.addThreadFactoryDependency(params.getThreadFactory(), serviceName, serviceBuilder, service.getThreadFactoryInjector(), target, params.getName() + "-threads");
                    serviceBuilder.addListener(verificationHandler);
                    serviceBuilder.install();

                    context.addStep(verificationHandler, OperationContext.Stage.VERIFY);

View Full Code Here

Examples of org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedOperationParameters

    static final OperationHandler INSTANCE = new BoundedQueueThreadPoolAdd();

    @Override
    public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) {
        final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils.parseBoundedThreadPoolOperationParameters(operation);

        //Apply to the model
        final ModelNode model = context.getSubModel();
        model.get(NAME).set(params.getName());
        if (params.getThreadFactory() != null) {
            model.get(THREAD_FACTORY).set(params.getThreadFactory());
        }
        if (params.getProperties() != null && params.getProperties().asList().size() > 0) {
            model.get(PROPERTIES).set(params.getProperties());
        }
        if (params.getMaxThreads() != null) {
            model.get(MAX_THREADS).set(operation.get(MAX_THREADS));
        }
        if (params.getKeepAliveTime() != null) {
            model.get(KEEPALIVE_TIME).set(operation.get(KEEPALIVE_TIME));
        }

        model.get(BLOCKING).set(params.isBlocking());
        if (params.getHandoffExecutor() != null) {
            model.get(HANDOFF_EXECUTOR).set(params.getHandoffExecutor());
        }
        model.get(ALLOW_CORE_TIMEOUT).set(params.isAllowCoreTimeout());
        if (params.getQueueLength() != null) {
            model.get(QUEUE_LENGTH).set(operation.get(QUEUE_LENGTH));
        }

        if (params.getCoreThreads() != null) {
            model.get(CORE_THREADS).set(operation.get(CORE_THREADS));
        }

        // Compensating is remove
        final ModelNode compensating = Util.getResourceRemoveOperation(params.getAddress());

        if (context.getRuntimeContext() != null) {
            context.getRuntimeContext().setRuntimeTask(new RuntimeTask() {
                public void execute(RuntimeTaskContext context) throws OperationFailedException {
                    ServiceTarget target = context.getServiceTarget();
                    final ServiceName serviceName = ThreadsServices.executorName(params.getName());
                    final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService(
                            params.getCoreThreads().getScaledCount(),
                            params.getMaxThreads().getScaledCount(),
                            params.getQueueLength().getScaledCount(),
                            params.isBlocking(),
                            params.getKeepAliveTime(),
                            params.isAllowCoreTimeout());

                    //TODO add the handoffExceutor injection

                    final ServiceBuilder<Executor> serviceBuilder = target.addService(serviceName, service);
                    ThreadsSubsystemThreadPoolOperationUtils.addThreadFactoryDependency(params.getThreadFactory(), serviceName, serviceBuilder, service.getThreadFactoryInjector(), target);
                    serviceBuilder.addListener(new ResultHandler.ServiceStartListener(resultHandler));
                    serviceBuilder.install();
                }
            });
        } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.