java 平时启动临时的线程 偷懒的做法是
new Thread(new Runnable() { @Override public void run() { } }).start();
其实通过线程池会更好。如下两种
ExecutorService threadPool = Executors.newFixedThreadPool(100); threadPool.execute(new Runnable() { @Override public void run() { } });
ExecutorService threadPool = Executors.newFixedThreadPool(100); Runnable runnable =()->{ //TODO }; threadPool.submit(runnable);