반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

[java] CompletableFuture에서 get()과 join() 본문

JAVA/java

[java] CompletableFuture에서 get()과 join()

닉의네임 2023. 8. 19. 21:48
반응형

Java의 CompletableFuture에서 get()과 join() 메소드는 모두 완료된 CompletableFuture의 결과를 반환

  get() join()
interrupt O X
interrupt 발생 InterruptedException 인터럽트 차단
Exception ExecutionException UncheckedExecutionException

 

 get() 메소드는 java.util.concurrent.Future 인터페이스에 정의되어 있으므로 이 인터페이스를 구현하는 다른 클래스와 호환 가능하지만, join() 메소드는 CompletableFuture 클래스에만 특화되어 있기 때문에 CompletableFuture와만 사용할 수 있다

 

일반적으로 CompletableFuture을 다룰 때는 join() 메소드를 사용하는 것이 좋음

반응형

'JAVA > java' 카테고리의 다른 글

[AOP] Aspect Oriented Programming  (0) 2023.07.22
[java] JAVA Stream 요소삭제 (remove)  (0) 2023.06.08
[java ]StringTokenizer  (0) 2023.05.10
[java] 쓰레드 세이프(Thread Safe)  (0) 2023.05.04
[java] AtomicInteger  (0) 2023.04.13
Comments