Answers
楼上提到
java.util.Timer
如果要使用,题主需要注意这种情况
public class BadCaseOfTimer {
public static void main(String[] args) {
Timer timer = new Timer();
timer.schedule(new ThrowTask(),1);
timer.schedule(new ThrowTask(),1);
}
static class ThrowTask extends TimerTask{
@Override
public void run() {
System.out.println("runnin.."+System.currentTimeMillis());
throw new RuntimeException();
}
}
}
天空中的人
answered 10 years, 4 months ago