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

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

Introduction

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

Prototype

public void setThreadPriority(int threadPriority) 

Source Link

Document

Set the priority of the threads that this factory creates.

Usage

From source file:burstcoin.jminer.core.CoreConfig.java

/**
 * Reader pool.//from ww  w  . jav  a  2 s  .co  m
 *
 * @return the thread pool task executor
 */
@Bean(name = "readerPool")
public ThreadPoolTaskExecutor readerPool() {
    ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.setThreadPriority(Thread.NORM_PRIORITY);
    // false-> triggers interrupt exception at shutdown
    pool.setWaitForTasksToCompleteOnShutdown(true);
    return pool;
}

From source file:burstcoin.jminer.core.CoreConfig.java

/**
 * Network pool./*  w w  w. ja v a 2s.  c  o  m*/
 *
 * @return the thread pool task executor
 */
@Bean(name = "networkPool")
public ThreadPoolTaskExecutor networkPool() {
    ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.setMaxPoolSize(2);
    pool.setThreadPriority(Thread.NORM_PRIORITY + 1);
    return pool;
}