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 T
around(java.util.function.Supplier<T> supplier)
T
get()
T
get(long timeout, java.util.concurrent.TimeUnit unit)
T
getNow(T valueIfAbsent)
protected T
getResult(java.util.concurrent.Callable<T> supplier)
T
join()
void
receiveResponse(java.lang.Object response_value, Address sender, boolean is_exception)
Callback (called by RequestCorrelator or Transport).boolean
responsesComplete()
void
sendRequest(Buffer data)
void
siteUnreachable(java.lang.String site)
java.lang.String
toString()
void
transportClosed()
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()T
waitForCompletion()
T
waitForCompletion(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:
sendRequest
in 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:
receiveResponse
in classRequest<T>
-
siteUnreachable
public void siteUnreachable(java.lang.String site)
- Specified by:
siteUnreachable
in 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:
viewChange
in classRequest<T>
-
transportClosed
public void transportClosed()
- Specified by:
transportClosed
in 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:
getNow
in classjava.util.concurrent.CompletableFuture<T>
-
waitForCompletion
public T waitForCompletion(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.Exception
Description copied from class:Request
Blocks until all responses have been received and returns result or throws exception- Specified by:
waitForCompletion
in classRequest<T>
- Throws:
java.lang.Exception
-
waitForCompletion
public T waitForCompletion() throws java.lang.Exception
- Specified by:
waitForCompletion
in classRequest<T>
- Throws:
java.lang.Exception
-
responsesComplete
public boolean responsesComplete()
-
-