You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
610 B
19 lines
610 B
|
4 years ago
|
package com.ynxbd.push.thread;
|
||
|
|
|
||
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
||
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
||
|
|
import java.util.concurrent.TimeUnit;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author 李进才
|
||
|
|
*/
|
||
|
|
public class ThreadConfig {
|
||
|
|
private ThreadConfig(){}
|
||
|
|
|
||
|
|
public static final Integer MAX_QUEUE_COUNT = 10000;
|
||
|
|
public static ThreadPoolExecutor getExecutor(int corePoolSize,int maximumPoolSize) {
|
||
|
|
LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>(MAX_QUEUE_COUNT);
|
||
|
|
return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 1000, TimeUnit.MINUTES, workQueue);
|
||
|
|
}
|
||
|
|
}
|