public abstract class Request extends java.lang.Object implements RspCollector, NotifyingFuture
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
block_for_results |
protected java.util.concurrent.locks.Condition |
completed
Is set as soon as the request has received all required responses
|
protected RequestCorrelator |
corr |
protected boolean |
done |
protected FutureListener |
listener |
protected java.util.concurrent.locks.Lock |
lock |
protected static Log |
log |
protected RequestOptions |
options |
protected long |
req_id |
protected static java.util.concurrent.atomic.AtomicLong |
REQUEST_ID
To generate unique request IDs (see getRequestId())
|
protected Message |
request_msg |
| 构造器和说明 |
|---|
Request(Message request,
RequestCorrelator corr,
RequestOptions options) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
protected void |
checkCompletion(java.util.concurrent.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(java.lang.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 |
siteUnreachable(java.lang.String site) |
abstract void |
suspect(Address mbr) |
java.lang.String |
toString() |
abstract void |
viewChange(View new_view) |
protected boolean |
waitForResults(long timeout) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittransportClosedprotected static final Log log
protected static final java.util.concurrent.atomic.AtomicLong REQUEST_ID
protected final java.util.concurrent.locks.Lock lock
protected final java.util.concurrent.locks.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)
NotifyingFuturesetListener 在接口中 NotifyingFuturelistener - listener to attachpublic boolean execute()
throws java.lang.Exception
java.lang.Exceptionprotected abstract void sendRequest()
throws java.lang.Exception
java.lang.Exceptionpublic abstract void receiveResponse(java.lang.Object response_value,
Address sender,
boolean is_exception)
receiveResponse 在接口中 RspCollectorpublic abstract void viewChange(View new_view)
viewChange 在接口中 RspCollectorpublic abstract void suspect(Address mbr)
suspect 在接口中 RspCollectorpublic abstract void siteUnreachable(java.lang.String site)
siteUnreachable 在接口中 RspCollectorprotected abstract boolean responsesComplete()
public boolean getResponsesComplete()
public boolean cancel(boolean mayInterruptIfRunning)
cancel 在接口中 java.util.concurrent.Futurepublic boolean isCancelled()
isCancelled 在接口中 java.util.concurrent.Futurepublic boolean isDone()
isDone 在接口中 java.util.concurrent.Futurepublic java.lang.String toString()
toString 在类中 java.lang.Objectprotected void checkCompletion(java.util.concurrent.Future future)
protected static long getRequestId()
protected boolean responsesComplete(long timeout)
throws java.lang.InterruptedException
execute()).java.lang.InterruptedExceptionprotected boolean waitForResults(long timeout)