private static final int TIME_OUT = 20000;
private long startTime;
public boolean isTimeOut(){
return (System.currentTimeMillis() - startTime >= TIME_OUT);
}
在起始点设置 startTime
需要超时的时候判定 isTimeOut
private static final int TIME_OUT = 20000;
private long startTime;
public boolean isTimeOut(){
return (System.currentTimeMillis() - startTime >= TIME_OUT);
}
在起始点设置 startTime
需要超时的时候判定 isTimeOut