You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
결과는 get 계산이 완료된 경우에만 메서드를 사용하여 검색할 수 있으며 필요한 경우 준비될때까지 차단되며 계산이 완료되었다면 계산을 취소할 수 없음
// 이 작업의 실행을 취소하려고 시도booleancancel(booleanmayInterruptIfRunning);
// 작업이 정상적으로 완료되기 전에 취소된 경우 true 반환booleanisCancelled();
// 작업이 완료되면 true 반환booleanisDone();
// 필요한 경우 계산이 완료될 때까지 기다린 다음 결과를 검색/* 발생 예외 CancellationException – 계산이 취소된 경우 ExecutionException - 계산에서 예외가 발생한 경우 InterruptedException – 현재 스레드가 대기하는 동안 중단된 경우*/Vget() throwsInterruptedException, ExecutionException;
// 위와 동일하나 최대 주어진 시간 동안 기다린다음 결과를 검색/* 발생 예외, 위의 예외는 모두 여전히 발생 TimeoutException - 대기 시간이 초과된 경우*/Vget(longtimeout, TimeUnitunit)
throwsInterruptedException, ExecutionException, TimeoutException;
FutureTask
Runnable과 Future을 상속받은 RuuableFuture 인터페이스를 상속받은 구현체 클래스로 비동기적으로 스레드를 실행하며 작업의 결과를 제공하고 작업 상태를 추적할 수 있음