Constructor and Description |
---|
TimedRequest(Request<M> request,
com.codahale.metrics.Timer timer) |
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.Object |
getKey() |
RequestPriority |
getPriority()
Returns the
RequestPriority of this request. |
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.
|
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
Request s message "on the wire". |
public boolean sendMessage()
Request
Request
s 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)
Request
ReadItem
s or WriteItem
s 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)
Request
public int getTimeout()
Request
getTimeout
in interface Request<M>
public boolean isRetryAllowed()
isRetryAllowed
in interface Request<M>
true
if retrying is allowed if Request.sendMessage()
returns false
.public RequestPriority getPriority()
Request
RequestPriority
of this request.getPriority
in interface Request<M>
RequestPriority
of this request.