Package org.springframework.scheduling.concurrent

Examples of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor


    System.out.println("file poller isRunning before start: " + filePoller.isRunning());
    controlChannel.send(MessageBuilder.withPayload("@filePoller.start()").build());
    System.out.println("file poller isRunning after start:  " + filePoller.isRunning());
    controlChannel.send(MessageBuilder.withPayload("@filePoller.stop()").build());
    System.out.println("file poller isRunning after stop:   " + filePoller.isRunning());
    ThreadPoolTaskExecutor executor = context.getBean("myExecutor", ThreadPoolTaskExecutor.class);
    System.out.println("max pool size before update: " + executor.getMaxPoolSize());
    controlChannel.send(MessageBuilder.withPayload("@myExecutor.setMaxPoolSize(25)").build());
    System.out.println("max pool size after update:  " + executor.getMaxPoolSize());
  }
View Full Code Here


  public void testWithExecutor() throws Exception {
    CachingConnectionFactory connectionFactory = beanFactory.getBean("withExecutor", CachingConnectionFactory.class);
    assertNotNull(connectionFactory);
    Object executor = new DirectFieldAccessor(connectionFactory).getPropertyValue("executorService");
    assertNotNull(executor);
    ThreadPoolTaskExecutor exec = beanFactory.getBean("exec", ThreadPoolTaskExecutor.class);
    assertSame(exec.getThreadPoolExecutor(), executor);
    DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
    assertEquals(Boolean.FALSE, dfa.getPropertyValue("publisherConfirms"));
    assertEquals(Boolean.FALSE, dfa.getPropertyValue("publisherReturns"));
    assertEquals(CachingConnectionFactory.CacheMode.CONNECTION, connectionFactory.getCacheMode());
    assertEquals(0,  TestUtils.getPropertyValue(connectionFactory, "rabbitConnectionFactory.connectionTimeout"));
View Full Code Here

  @Test
  public void testAtomicSendAndReceiveExternalExecutor() throws Exception {
    final CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
    connectionFactory.setHost("localhost");
    ThreadPoolTaskExecutor exec = new ThreadPoolTaskExecutor();
    final String execName = "make-sure-exec-passed-in";
    exec.setBeanName(execName);
    exec.afterPropertiesSet();
    connectionFactory.setExecutor(exec);
    final Field[] fields = new Field[1];
    ReflectionUtils.doWithFields(RabbitTemplate.class, new FieldCallback() {
      @Override
      public void doWith(Field field) throws IllegalArgumentException,
View Full Code Here

  private int threadPoolSize = 10;

  @Bean
  public EngineRunner engineRunner()
  {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(threadPoolSize);
    executor.setMaxPoolSize(threadPoolSize);
    executor.setQueueCapacity(0);
    executor.initialize();

    ThreadPoolEngineRunner runner = new ThreadPoolEngineRunner();
    runner.setIdleTime(idleTime);
    runner.setFetchSize(threadPoolSize);
    runner.setExecutor(executor);
View Full Code Here

  protected void setThreadPoolSize(int n)
  {
    getProcessServer().getEngineRunner().setFetchSize(n);
    if (getProcessServer().getEngineRunner() instanceof ThreadPoolEngineRunner)
    {
      ThreadPoolTaskExecutor executor = ((ThreadPoolEngineRunner) getProcessServer().getEngineRunner())
        .getExecutor();
      executor.setCorePoolSize(n);
      executor.setMaxPoolSize(n);
      executor.setQueueCapacity(0);
      executor.initialize();
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor

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.