public static ExecutorService newFixThreadPool(int nThreads){ return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());}//利用Executors.newFixThreadPool(5).execute(r);
public static ExecutorService newCachedThreadPool(int nThreads){ return new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit. SECONDS, new SynchronousQueue<Runnable>());}//利用Executors.newCachedThreadPool().execute(r);
默认的1L,好比:private static final long serialVersionUID = 1L;
根据包名,类名,继承关系,非私有的方法和属性,以及参数,返回值等诸多因子计算得出的,非常复杂天生的一个64位的哈希字段。根本上计算出来的这个值是唯一的。好比:private static final long serialVersionUID = xxxxL; 注意:体现声明serialVersionUID可以制止对象不同等