StopWatch stopWatch = new StopWatch();
this("");
public StopWatch(String id) {
//报留任务清单设置为true
this.keepTaskList = true;
//初始化一个任务清单
this.taskList = new LinkedList();
//id设置为空
this.id = id;
}
我们再来看下start方法
stopWatch.start();
public void start() throws IllegalStateException {
this.start("");
}
public void start(String taskName) throws IllegalStateException {
//当前任务名称不为空抛出异常
if (this.currentTaskName != null) {
throw new IllegalStateException("Can't start StopWatch: it's already running");
} else {
//currentTaskName设置为空
this.currentTaskName = taskName;
//计时
this.startTimeMillis = System.currentTimeMillis();
}
}
stopWatch.stop();
public void stop() throws IllegalStateException {
//如果当前任务名称为null抛出异常
if (this.currentTaskN