Example usage for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor getCorePoolSize

List of usage examples for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor getCorePoolSize

Introduction

In this page you can find the example usage for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor getCorePoolSize.

Prototype

public int getCorePoolSize() 

Source Link

Document

Return the ThreadPoolExecutor's core pool size.

Usage

From source file:com.github.liyp.rabbitmq.demo.Main.java

public static void main(String[] args) throws IOException, InterruptedException {
    // start spring context
    @SuppressWarnings({ "resource" })
    ApplicationContext context = new ClassPathXmlApplicationContext(
            "com/github/liyp/rabbitmq/demo/applicationContext.xml");

    RabbitTemplate rabbitTemplate = (RabbitTemplate) context.getBean("rabbitTemplate");
    for (int i = 0; i < 200; i++) {
        rabbitTemplate.convertAndSend("queue_one", "test queue 1 " + i);
        rabbitTemplate.convertAndSend("queue_two", new MsgBean("test queue 2 " + i));
    }//  w  ww  .j av  a2s. c om
    Thread.sleep(5000);
    ThreadPoolTaskExecutor threadExe = (ThreadPoolTaskExecutor) context.getBean("taskExecutor");
    System.out.println(threadExe.getActiveCount());
    System.out.println(threadExe.getCorePoolSize());
    System.out.println(threadExe.getMaxPoolSize());
    System.out.println(threadExe.getPoolSize());
    System.out.println(threadExe.getThreadPoolExecutor().getCorePoolSize());

    // System.out.println("rsv: " +
    // rabbitTemplate.receiveAndConvert("queue_two"));
}