1 回答

TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超8個(gè)贊
AWS SDK 異步請(qǐng)求返回CompletableFuture
。默認(rèn)情況下,對(duì)返回實(shí)例的調(diào)用thenApply(..)
和對(duì)返回實(shí)例的調(diào)用將在類似線程上執(zhí)行。async配置的思路是提供線程池executor,用于后續(xù)對(duì)like和 的調(diào)用。該執(zhí)行器將不會(huì)應(yīng)用于像和由于實(shí)現(xiàn)這樣的方法(如果未將執(zhí)行器傳遞給,它將默認(rèn)使用,或者我們可以將自定義執(zhí)行器作為第二個(gè)方法參數(shù)傳遞)。whenComplete(..)
CompletableFuture
sdk-async-response-0-X
SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR
CompletableFuture
thenApply(..)
whenComplete(..)
thenApplyAsync
whenCompleteAsync
CompletableFuture
thenApplyAsync(..)
ForkJoinPool.commonPool()
snsAsyncClient.publish(publishRequest) .thenApply(..) .whenComplete(..);
內(nèi)部代碼thenApply
,whenComplete
將在配置的執(zhí)行程序上處理SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR
。
添加回答
舉報(bào)