T
- the type of successful replypublic final class ReplyFutureMap<T> extends Object
CompletableFuture
for asynchronous request-reply communication.Constructor and Description |
---|
ReplyFutureMap() |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<T> |
beforeRequest(long id)
Called by message sender, just before a new request is sent.
|
void |
onFailure(long id,
Throwable ex)
Called for a failure in request-reply communication.
|
void |
onSuccessMessage(long id,
T successMessage)
Called by message receiver, for a successful reply message.
|
public CompletableFuture<T> beforeRequest(long id)
onSuccessMessage
can be called before putting new future to requestIdToFuture
.id
- the request idCompletableFuture
for the replypublic void onSuccessMessage(long id, T successMessage)
id
- the request idsuccessMessage
- the reply messagepublic void onFailure(long id, Throwable ex)
id
- the request idex
- throwable exceptionCopyright © 2018. All rights reserved.