:자바 수면 interupted 사람이 오류 설명 할 수 예외
private static ExecutorService es = Executors.newFixedThreadPool(1);;
private static List<Future<?>> futures = new ArrayList<Future<?>>();
futures.add(es.submit(new Callable<Object>() {
public Object call() throws Exception {
try{
Polling.start(); //has an while(true) loop
} catch (Exception e){
e.printStackTrace();
}
return null;
}
}));
Thread.sleep(2000);
System.out.println("stopping...");
es.shutdownNow();
futures.clear();
이 제공 :
java.lang.InterruptedException: sleep interrupted
어떻게 main 메소드의 지연을 처리하여, 위의 예외를 피하기 위해를?
당신은 무한 루프에서 잠을 계속 이는 호출을 설정하는
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at bus.Polling.start(Polling.java:107)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
show stacktrace – confucius