67,513
社区成员
发帖
与我相关
我的任务
分享
while(true)
{
handshake();
sleep(60000);
}
public void run() {
try {
while (true) {
long current = System.currentTimeMillis();
long k = next_send_time - current;
if (k > 0) {
Thread.sleep(k);
} else {
//handshake()
Thread.sleep(60 * 1000);
}
}
} catch (InterruptedException ex) {
}
}
public synchronized void refreshNextTime() {
next_send_time = System.currentTimeMillis() + 60 * 1000;
}
private volatile long next_send_time;//下一次发起请求的日期