标签:timertask ati interrupt throw tor inter scheduled over rgs
package com.zhy.concurrency.timer; import java.util.Date; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class ScheduledThreadPoolDemo01 { public static void main(String[] args) throws InterruptedException { final TimerTask task1 = new TimerTask() { @Override public void run() { throw new RuntimeException(); } }; final TimerTask task2 = new TimerTask() { @Override public void run() { System.out.println("task2 invoked!"); } }; ScheduledExecutorService pool = Executors.newScheduledThreadPool(1); pool.schedule(task1, 100, TimeUnit.MILLISECONDS); pool.scheduleAtFixedRate(task2, 0 , 1000, TimeUnit.MILLISECONDS); } }
标签:timertask ati interrupt throw tor inter scheduled over rgs
原文地址:https://www.cnblogs.com/tonggc1668/p/9299279.html