public class ScheduledRequest<M> extends java.lang.Object implements Request<M>
Request and the corresponding Set of
AggregateSubscriptionItems making up
that Request that a driver implementation has optimized.
ScheduledRequests are what make up the bulk of the "subscription" logic for a driver; that is,
repeated and
perpetually self-scheduling read Requests.
Equality and hash code are based on the Set of AggregateSubscriptionItems and the rate.
| Constructor and Description |
|---|
ScheduledRequest(Request<M> request,
RequestCycle<M> requestCycle,
int rate,
java.util.List<AggregateSubscriptionItem> items,
long idealSendTime,
com.codahale.metrics.Timer timer) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
void |
fail(FailureType type,
DriverState state,
java.lang.Exception ex)
Called if the response to the most recently created message is not going to be received.
|
long |
getIdealSendTime() |
java.util.List<AggregateSubscriptionItem> |
getItems() |
java.lang.Object |
getKey() |
long |
getLastPost() |
long |
getLastReceive() |
long |
getLastSend() |
RequestPriority |
getPriority()
Returns the
RequestPriority of this request. |
int |
getRate() |
int |
getTimeout()
Returns the amount of time (in milliseconds) that this request should be given to run, before it is failed out
for a timeout.
|
int |
hashCode() |
boolean |
isCanceled() |
boolean |
isRetryAllowed() |
ReceiveAction |
receiveMessage(M message,
java.lang.Object key)
Called when a response message is received for this Request.
|
boolean |
sendMessage()
Creates and puts the
Requests message "on the wire". |
void |
setCanceled(boolean canceled) |
java.lang.String |
toString() |
public ScheduledRequest(Request<M> request, RequestCycle<M> requestCycle, int rate, java.util.List<AggregateSubscriptionItem> items, long idealSendTime, com.codahale.metrics.Timer timer)
public boolean sendMessage()
RequestRequests message "on the wire". Each call should send a unique message
(different transaction ID, if applicable), in case the request is re-used.sendMessage in interface Request<M>public java.lang.Object getKey()
public ReceiveAction receiveMessage(M message, java.lang.Object key)
RequestReadItems or WriteItems that it contains (if applicable).
If you are extending from AbstractSocketDriver you must do this work on the thread this call arrived on
or risk the byte[] message being returned its pool and reused in the middle of processing it.receiveMessage in interface Request<M>message - The message that was received for this Request.key - The key used to retrieve this Request.ReceiveAction that indicates what the driver should do with this request.public void fail(FailureType type, DriverState state, java.lang.Exception ex)
Requestpublic int getTimeout()
RequestgetTimeout in interface Request<M>public final boolean isRetryAllowed()
isRetryAllowed in interface Request<M>true if retrying is allowed if Request.sendMessage() returns false.public RequestPriority getPriority()
RequestRequestPriority of this request.getPriority in interface Request<M>RequestPriority of this request.public boolean isCanceled()
public void setCanceled(boolean canceled)
public java.util.List<AggregateSubscriptionItem> getItems()
public int getRate()
public long getIdealSendTime()
public long getLastSend()
public long getLastPost()
public long getLastReceive()
public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object