package util;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.*;
public class ThreadManage {
private static ExecutorService executorService=getExecutorService();
private static ExecutorService executorService2=test();
public static ExecutorService getExecutorService(){
ThreadFactory nameThreadFactory=new ThreadFactoryBuilder().setNameFormat("thread-pool-cuhome-%d").build();
ExecutorService executorService1=new ThreadPoolExecutor(4,8,3000, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>(1024),nameThreadFactory,new ThreadPoolExecutor.AbortPolicy());
return executorService1;
}
private static ScheduledExecutorService test(){
ThreadFactory threadFactory=new ThreadFactoryBuilder().setNameFormat("thread-schdule-%d").build();
ScheduledExecutorService scheduledExecutorService=new ScheduledThreadPoolExecutor(1,threadFactory);
return scheduledExecutorService;
}
}