[CompletableFuture][#3] 메소드 정리-1

JAVA|2019. 9. 1. 20:40

지난번에 static 메소드를 정리해보았고

이제 CompletableFuture(이하 cf)의 메소드에 대해 정리해보려고 합니다.

정리하려고 public 메소드를 뽑아보았더니...

굉장히 길었습니다..

그래서 조금 나누어 정리해야 할것 같아 메서드 네이밍을 쭉 살펴보니

크게 두가지로 나눠 보았습니다.

  • 실행 후 제어(thenRun, handle....)
    • sync
      • acceptEither
      • applyToEither
      • handle
      • runAfterBoth
      • runAfterEither
      • thenAccept
      • thenAcceptBoth
      • thenApply
      • thenCombine
      • thenCompose
      • thenRun
      • whenComplete
    • async
      • acceptEitherAsync
      • applyToEitherAsync
      • handleAsync
      • runAfterBothAsync
      • runAfterEitherAsync
      • thenAcceptAsync
      • thenAcceptBothAsync
      • thenApplyAsync
      • thenCombineAsync
      • thenComposeAsync
      • thenRunAsync
      • whenCompleteAsync
  • async 한 작업을 대기하거나 상태를 확인 및 기타등등(get, isDone, join ....)
    • cacel
    • complete
    • completeExceptionally
    • exceptionally
    • get()
    • get(time)
    • getNow
    • getNumberOfDependents
    • isCancelled
    • isCompletedExceptionally
    • isDone
    • join
    • obtrudeException(Throwable)
    • obtrudeValue(R)

먼저 "실행 후 제어(thenRun, handle....)" 메서드 를 살펴보겠습니다.

위에 정리한것처럼 Async 가 붙은것 붙지 않은것이 각각 존재 합니다.

아직 다 살펴보지 않아 정확하지는 않지만 async가 메소드명에 붙고 안붙는것에 따라 sync/async가 갈릴것으로 파악 됩니다.

하나씩 살펴보겠습니다.

acceptEither

applyToEither

handle

runAfterBoth

runAfterEither

thenAccept

thenAcceptBoth

thenApply

thenCombine

thenCompose

thenRun

whenComplete

Async

acceptEitherAsync
applyToEitherAsync
handleAsync
runAfterBothAsync
runAfterEitherAsync
thenAcceptAsync
thenAcceptBothAsync
thenApplyAsync
thenCombineAsync
thenComposeAsync
thenRunAsync
whenCompleteAsync

Util
cacel
complete
completeExceptionally
exceptionally
get()
get(time)
getNow
getNumberOfDependents
isCancelled
isCompletedExceptionally
isDone
join
obtrudeException(Throwable)
obtrudeValue(R)

'JAVA' 카테고리의 다른 글

java.util.function 인터페이스  (0) 2019.12.30
JEP 218: Generics over Primitive Types  (0) 2019.12.10
[Quartz] Trigger  (0) 2019.07.10
[CompletableFuture][#2] staticMethod  (0) 2019.07.09
[CompletableFuture][#1] 정리시작  (0) 2019.07.03

댓글()