我有一个“可运行”类的代码片段是这样的:
public void run() {
//Do some stuff
while(!someCondition){
//Do some stuff
while(anotherCondition){
try {
Thread.sleep(60000);
}catch (InterruptedException e){
logger.error(e.getMessage());
e.printStackTrace();
}
//Do some stuff
}
threadExecutor = Executors.newCachedThreadPool();
RunnableClass rc = new RunnableClass();
Thread rcThread = new Thread(rc);
rcThread.setDefaultUncaughtExceptionHandler(new SomeUncaughtExHandler());
threadExecutor.execute(rcThread);
}
//Do some stuff
}
调用是否Thread.sleep(60000);
会导致所有 RunnableClass 线程休眠?