Package org.jgroups.blocks
Class UnicastRequest<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- org.jgroups.blocks.Request<T>
-
- org.jgroups.blocks.UnicastRequest<T>
-
- All Implemented Interfaces:
java.util.concurrent.CompletionStage<T>,java.util.concurrent.Future<T>
public class UnicastRequest<T> extends Request<T>
Sends a request to a single target destination- Author:
- Bela Ban
-
-
Constructor Summary
Constructors Constructor Description UnicastRequest(RequestCorrelator corr, Address target, RequestOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Taround(java.util.function.Supplier<T> supplier)Tget()Tget(long timeout, java.util.concurrent.TimeUnit unit)TgetNow(T valueIfAbsent)protected TgetResult(java.util.concurrent.Callable<T> supplier)Tjoin()voidreceiveResponse(java.lang.Object response_value, Address sender, boolean is_exception)Callback (called by RequestCorrelator or Transport).booleanresponsesComplete()voidsendRequest(Buffer data)voidsiteUnreachable(java.lang.String site)java.lang.StringtoString()voidtransportClosed()voidviewChange(View view, boolean handle_previous_subgroups)If the target address is not a member of the new view, we'll mark the response as suspected and unblock the caller of execute()TwaitForCompletion()TwaitForCompletion(long timeout, java.util.concurrent.TimeUnit unit)Blocks until all responses have been received and returns result or throws exception-
Methods inherited from class org.jgroups.blocks.Request
cancel, corrDone, execute, requestId, requestId, setResponseFilter
-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
-
-
-
-
Field Detail
-
target
protected final Address target
-
-
Constructor Detail
-
UnicastRequest
public UnicastRequest(RequestCorrelator corr, Address target, RequestOptions options)
-
-
Method Detail
-
sendRequest
public void sendRequest(Buffer data) throws java.lang.Exception
- Specified by:
sendRequestin classRequest<T>- Throws:
java.lang.Exception
-
receiveResponse
public void receiveResponse(java.lang.Object response_value, Address sender, boolean is_exception)Callback (called by RequestCorrelator or Transport). Adds a response to the response table. When all responses have been received,execute()returns.- Specified by:
receiveResponsein classRequest<T>
-
siteUnreachable
public void siteUnreachable(java.lang.String site)
- Specified by:
siteUnreachablein classRequest<T>
-
viewChange
public void viewChange(View view, boolean handle_previous_subgroups)
If the target address is not a member of the new view, we'll mark the response as suspected and unblock the caller of execute()- Specified by:
viewChangein classRequest<T>
-
transportClosed
public void transportClosed()
- Specified by:
transportClosedin classRequest<T>
-
get
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
-
get
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
-
getNow
public T getNow(T valueIfAbsent)
- Overrides:
getNowin classjava.util.concurrent.CompletableFuture<T>
-
waitForCompletion
public T waitForCompletion(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.Exception
Description copied from class:RequestBlocks until all responses have been received and returns result or throws exception- Specified by:
waitForCompletionin classRequest<T>- Throws:
java.lang.Exception
-
waitForCompletion
public T waitForCompletion() throws java.lang.Exception
- Specified by:
waitForCompletionin classRequest<T>- Throws:
java.lang.Exception
-
responsesComplete
public boolean responsesComplete()
-
-