Package org.jgroups.blocks
Class Request<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- org.jgroups.blocks.Request<T>
-
- All Implemented Interfaces:
java.util.concurrent.CompletionStage<T>
,java.util.concurrent.Future<T>
- Direct Known Subclasses:
GroupRequest
,UnicastRequest
public abstract class Request<T> extends java.util.concurrent.CompletableFuture<T>
Abstract class for a unicast or multicast request- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected RequestCorrelator
corr
protected RequestOptions
options
protected long
req_id
protected long
start_time
-
Constructor Summary
Constructors Constructor Description Request(RequestCorrelator corr, RequestOptions options)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
cancel(boolean mayInterruptIfRunning)
protected void
corrDone()
T
execute(Message msg, boolean block_for_results)
abstract void
memberUnreachable(Address mbr)
abstract void
receiveResponse(java.lang.Object response_value, Address sender, boolean is_exception)
long
requestId()
Request<T>
requestId(long req_id)
abstract void
sendRequest(Message req)
Request<T>
setResponseFilter(RspFilter filter)
abstract void
siteUnreachable(java.lang.String site)
java.lang.String
toString()
abstract void
transportClosed()
abstract void
viewChange(View new_view, boolean handle_previous_subgroups)
abstract T
waitForCompletion()
abstract 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 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, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, 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
-
req_id
protected long req_id
-
corr
protected final RequestCorrelator corr
-
options
protected final RequestOptions options
-
start_time
protected long start_time
-
-
Constructor Detail
-
Request
public Request(RequestCorrelator corr, RequestOptions options)
-
-
Method Detail
-
requestId
public long requestId()
-
execute
public T execute(Message msg, boolean block_for_results) throws java.lang.Exception
- Throws:
java.lang.Exception
-
sendRequest
public abstract void sendRequest(Message req) throws java.lang.Exception
- Throws:
java.lang.Exception
-
receiveResponse
public abstract void receiveResponse(java.lang.Object response_value, Address sender, boolean is_exception)
-
viewChange
public abstract void viewChange(View new_view, boolean handle_previous_subgroups)
-
siteUnreachable
public abstract void siteUnreachable(java.lang.String site)
-
memberUnreachable
public abstract void memberUnreachable(Address mbr)
-
transportClosed
public abstract void transportClosed()
-
waitForCompletion
public abstract T waitForCompletion(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.Exception
Blocks until all responses have been received and returns result or throws exception- Throws:
java.lang.Exception
-
waitForCompletion
public abstract T waitForCompletion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.concurrent.CompletableFuture<T>
-
corrDone
protected void corrDone()
-
-