public class FixedThreadUtil { private ExecutorService fixedThreadPool; private FixedThreadUtil() { if (fixedThreadPool == null) { fixedThreadPool = Executors.newFixedThreadPool(20); } } private static FixedThreadUtil instance; public static FixedThreadUtil getInstance() { if (instance == null) { instance = new FixedThreadUtil(); } return instance; } public void executeTask(Runnable runnable) { fixedThreadPool.execute(runnable); } public static void main(String[] args) { for (int i = 0; i < 100; i++) { FixedThreadUtil.getInstance().executeTask(new Runnable(){ @Override public void run() { System.out.println("test"+Thread.currentThread().getName()); try { System.out.println("yc-"); Thread.sleep(9000); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } }