public abstract class Request extends Object implements RspCollector, NotifyingFuture
Modifier and Type | Field and Description |
---|---|
protected boolean |
block_for_results |
protected Condition |
completed
Is set as soon as the request has received all required responses
|
protected RequestCorrelator |
corr |
protected boolean |
done |
protected FutureListener |
listener |
protected Lock |
lock |
protected static Log |
log |
protected RequestOptions |
options |
protected long |
req_id |
protected static AtomicLong |
REQUEST_ID
To generate unique request IDs (see getRequestId())
|
protected Message |
request_msg |
Constructor and Description |
---|
Request(Message request,
RequestCorrelator corr,
RequestOptions options) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
protected void |
checkCompletion(Future future) |
boolean |
execute() |
boolean |
getBlockForResults() |
protected static long |
getRequestId()
Generates a new unique request ID
|
boolean |
getResponsesComplete() |
boolean |
isCancelled() |
boolean |
isDone() |
abstract void |
receiveResponse(Object response_value,
Address sender,
boolean is_exception) |
protected abstract boolean |
responsesComplete() |
protected boolean |
responsesComplete(long timeout)
This method runs with lock locked (called by
execute() ). |
protected abstract void |
sendRequest() |
void |
setBlockForResults(boolean block_for_results) |
NotifyingFuture |
setListener(FutureListener listener)
Attaches a listener and returns the same future instance, to allow for 'building' futures.
|
void |
setResponseFilter(RspFilter filter) |
abstract void |
suspect(Address mbr) |
String |
toString() |
abstract void |
viewChange(View new_view) |
protected boolean |
waitForResults(long timeout) |
protected static final Log log
protected static final AtomicLong REQUEST_ID
protected final Lock lock
protected final Condition completed
protected final Message request_msg
protected final RequestCorrelator corr
protected final RequestOptions options
protected volatile boolean done
protected boolean block_for_results
protected final long req_id
protected volatile FutureListener listener
public Request(Message request, RequestCorrelator corr, RequestOptions options)
public void setResponseFilter(RspFilter filter)
public boolean getBlockForResults()
public void setBlockForResults(boolean block_for_results)
public NotifyingFuture setListener(FutureListener listener)
NotifyingFuture
setListener
in interface NotifyingFuture
listener
- listener to attachpublic abstract void receiveResponse(Object response_value, Address sender, boolean is_exception)
receiveResponse
in interface RspCollector
public abstract void viewChange(View new_view)
viewChange
in interface RspCollector
public abstract void suspect(Address mbr)
suspect
in interface RspCollector
protected abstract boolean responsesComplete()
public boolean getResponsesComplete()
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future
protected void checkCompletion(Future future)
protected static long getRequestId()
protected boolean responsesComplete(long timeout) throws InterruptedException
execute()
).InterruptedException
protected boolean waitForResults(long timeout)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.