Package org.apache.camel.builder

Examples of org.apache.camel.builder.ThreadPoolProfileBuilder


        executorService = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, name, this, false);
        // if no explicit then create from the options
        if (executorService == null) {
            ExecutorServiceManager manager = routeContext.getCamelContext().getExecutorServiceManager();
            // create the thread pool using a builder
            ThreadPoolProfile profile = new ThreadPoolProfileBuilder(name)
                    .poolSize(getPoolSize())
                    .maxPoolSize(getMaxPoolSize())
                    .keepAliveTime(getKeepAliveTime(), getTimeUnit())
                    .maxQueueSize(getMaxQueueSize())
                    .rejectedPolicy(getRejectedPolicy())
View Full Code Here


        int queueSize = -1;
        if (maxQueueSize != null) {
            queueSize = CamelContextHelper.parseInteger(getCamelContext(), maxQueueSize);
        }

        ThreadPoolProfile profile = new ThreadPoolProfileBuilder(getId())
                .poolSize(size)
                .maxPoolSize(max)
                .keepAliveTime(keepAlive, timeUnit)
                .maxQueueSize(queueSize)
                .rejectedPolicy(rejectedPolicy)
View Full Code Here

        ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, name, this, false);
        // if no explicit then create from the options
        if (threadPool == null) {
            ExecutorServiceManager manager = routeContext.getCamelContext().getExecutorServiceManager();
            // create the thread pool using a builder
            ThreadPoolProfile profile = new ThreadPoolProfileBuilder(name)
                    .poolSize(getPoolSize())
                    .maxPoolSize(getMaxPoolSize())
                    .keepAliveTime(getKeepAliveTime(), getTimeUnit())
                    .maxQueueSize(getMaxQueueSize())
                    .rejectedPolicy(getRejectedPolicy())
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // register thread pool profile
                ThreadPoolProfile profile = new ThreadPoolProfileBuilder("myProfile").poolSize(5).maxPoolSize(10).maxQueueSize(20).build();
                context.getExecutorServiceManager().registerThreadPoolProfile(profile);

                from("direct:start")
                    .multicast(new AggregationStrategy() {
                            public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
View Full Code Here

        int queueSize = -1;
        if (maxQueueSize != null) {
            queueSize = CamelContextHelper.parseInteger(getCamelContext(), maxQueueSize);
        }

        ThreadPoolProfile profile = new ThreadPoolProfileBuilder(getId())
                .poolSize(size)
                .maxPoolSize(max)
                .keepAliveTime(keepAlive, timeUnit)
                .maxQueueSize(queueSize)
                .rejectedPolicy(rejectedPolicy)
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // create a profile for the throttler
                ThreadPoolProfileBuilder builder = new ThreadPoolProfileBuilder("myThrottler");
                builder.maxQueueSize(2);
                context.getExecutorServiceManager().registerThreadPoolProfile(builder.build());
               
                from("seda:start")
                    .throttle(1).timePeriodMillis(100)
                        .asyncDelayed().executorServiceRef("myThrottler").callerRunsWhenRejected(true)
                    .to("mock:result");
View Full Code Here

*/
public class CustomThreadPoolProfileRouteBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        ThreadPoolProfile customThreadPoolProfile =
            new ThreadPoolProfileBuilder("customThreadPoolProfile").poolSize(5).maxQueueSize(100).build();
        ModelCamelContext context = getContext();
        context.getExecutorServiceManager().registerThreadPoolProfile(customThreadPoolProfile);

        from("direct:in")
            .log("Received ${body}:${threadName}")
View Full Code Here

import java.util.List;

public class ThrottlerAsyncDelayedTest extends CamelTestSupport {
    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        ThreadPoolProfileBuilder builder = new ThreadPoolProfileBuilder("myThrottler");
        builder.maxQueueSize(5);
        context.getExecutorServiceManager().registerThreadPoolProfile(builder.build());

        return new ThrottlerAsyncDelayedRouteBuilder();
    }
View Full Code Here

        int queueSize = -1;
        if (maxQueueSize != null) {
            queueSize = CamelContextHelper.parseInteger(getCamelContext(), maxQueueSize);
        }

        ThreadPoolProfile profile = new ThreadPoolProfileBuilder(getId())
                .poolSize(size)
                .maxPoolSize(max)
                .keepAliveTime(keepAlive, timeUnit)
                .maxQueueSize(queueSize)
                .rejectedPolicy(rejectedPolicy)
View Full Code Here

        ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, name, this, false);
        // if no explicit then create from the options
        if (threadPool == null) {
            ExecutorServiceManager manager = routeContext.getCamelContext().getExecutorServiceManager();
            // create the thread pool using a builder
            ThreadPoolProfile profile = new ThreadPoolProfileBuilder(name)
                    .poolSize(getPoolSize())
                    .maxPoolSize(getMaxPoolSize())
                    .keepAliveTime(getKeepAliveTime(), getTimeUnit())
                    .maxQueueSize(getMaxQueueSize())
                    .rejectedPolicy(getRejectedPolicy())
View Full Code Here

TOP

Related Classes of org.apache.camel.builder.ThreadPoolProfileBuilder

Copyright © 2018 www.massapicom. 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.