PoolThread { public void schelThread() { ScheduledExecutorService pool = Executors.newScheduledThreadPool(1); pool.scheduleAtFixedRate(new Runnable() { public void run() { log.info("scheduled 线程池：1"+Thread.currentThread().getName()); } }, 0, 5000, TimeUnit.MILLISECONDS); pool.scheduleAtFixedRate(new Runnable() { public void run() { log.info("scheduled 线程池：2"+Thread.currentThread().getName()); } }, 0, 2000, TimeUnit.MILLISECONDS); pool.scheduleWithFixedDelay(new Runnable() { public void run() { log.info("scheduled 线程池：3"+Thread.currentThread().getName()); try { Thread.sleep(4000); } catch (InterruptedException e) { e.printStackTrace(); } } }, 0, 2000, TimeUnit.MILLISECONDS); }  static void main(String[] args); void cachedThreadPool(); void fixedThread(); void singleThread(); void schelThread(); void await(); Thread getThread(final String name); Thread getSingleThread(final String name); Thread getSleepThread(final String name);  }
@Test public void testSchelThread() throws Exception { PoolThread pt = new PoolThread(); pt.schelThread(); }