Examples of ThreadPoolTaskExecutor


Examples of org.jtrim.concurrent.ThreadPoolTaskExecutor

        if (threadCount == 1) {
            return new SingleThreadedExecutor(name, Integer.MAX_VALUE, IDLE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
        }
        else {
            return new ThreadPoolTaskExecutor(name, threadCount, Integer.MAX_VALUE, IDLE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
        }
    }
View Full Code Here

Examples of org.springframework.scheduling.backportconcurrent.ThreadPoolTaskExecutor

        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        JmsComponent jms = jmsComponentClientAcknowledge(connectionFactory);

        // use a spring 2.x task executor
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(4);
        executor.setMaxPoolSize(16);
        executor.setThreadNamePrefix("foo");
        executor.afterPropertiesSet();
        jms.setTaskExecutorSpring2(executor);

        camelContext.addComponent("activemq", jms);

        return camelContext;
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

  private UserManager userManager;
 
  protected void setUp() throws Exception {
    super.setUp();
   
    executor = new ThreadPoolTaskExecutor();
    executor.initialize();
   
    userManager = new UserManager(getGnizrDao());
    forUserManager = new ForUserManager(getGnizrDao());
    folderManager = new FolderManager(getGnizrDao());
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

    @Value("${spring.yarn.batch.name:}")
    private String jobName;

    @Bean(name=YarnContextUtils.TASK_EXECUTOR_BEAN_NAME)
    public TaskExecutor threadPoolTaskExecutor() {
      ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
      executor.setCorePoolSize(2);
      return executor;
    }
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

    @Override
    @Bean
    public Executor getAsyncExecutor() {
        log.debug("Creating Async Task Executor");
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(propertyResolver.getProperty("corePoolSize", Integer.class, 2));
        executor.setMaxPoolSize(propertyResolver.getProperty("maxPoolSize", Integer.class, 50));
        executor.setQueueCapacity(propertyResolver.getProperty("queueCapacity", Integer.class, 10000));
        executor.setThreadNamePrefix("<%= _.slugify(baseName) %>-Executor-");
        return new ExceptionHandlingAsyncTaskExecutor(executor);
    }
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

    public boolean isUseRouteBuilder() {
        return false;
    }

    private void sendMessagesToQueue() throws Exception {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.afterPropertiesSet();
        executor.execute(new Runnable() {
            public void run() {
                for (int i = 0; i < 20; i++) {
                    try {
                        // do some random sleep to simulate spread in user activity
                        Thread.sleep(new Random().nextInt(10));
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

        int total = 10000;
        final int group = total / 20;
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(total);

        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(20);
        executor.afterPropertiesSet();
        for (int i = 0; i < 20; i++) {
            final int threadCount = i;
            executor.execute(new Runnable() {
                public void run() {
                    int start = threadCount * group;
                    for (int i = 0; i < group; i++) {
                        try {
                            // do some random sleep to simulate spread in user activity
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

    public boolean isUseRouteBuilder() {
        return false;
    }

    private void sendMessagesToQueue() throws Exception {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.afterPropertiesSet();
        executor.execute(new Runnable() {
            public void run() {
                for (int i = 0; i < 20; i++) {
                    // when this delay is removed, the seda endpoint has ordering issues
                    try {
                        // do some random sleep to simulate spread in user activity
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

        // latch for the 5 exchanges we expect
        final CountDownLatch latch = new CountDownLatch(5);
        long start = System.currentTimeMillis();

        // setup a task executor to be able send the messages in parallel
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);
        executor.afterPropertiesSet();
        for (int i = 0; i < 5; i++) {
            final int count = i;
            executor.execute(new Runnable() {
                public void run() {
                    // requestbody is InOut pattern and thus we expect a reply (JMSReply)
                    Object response = template.requestBody("activemq:a", "World #" + count);
                    assertEquals("Bye World #" + count, response);
                    latch.countDown();
View Full Code Here

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(total);

        // setup a task executor to be able send the messages in parallel
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);
        executor.afterPropertiesSet();
        for (int i = 0; i < 5; i++) {
            final int threadCount = i;
            executor.execute(new Runnable() {
                public void run() {
                    int start = threadCount * 200;
                    for (int i = 0; i < 200; i++) {
                        try {
                            // do some random sleep to simulate spread in user activity
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.