Package org.apache.cassandra.net
Class RequestCallbacks
- java.lang.Object
-
- org.apache.cassandra.net.RequestCallbacks
-
public class RequestCallbacks extends java.lang.Object
An expiring map of request callbacks. Used to match response (id, peer) pairs to correspondingRequestCallback
s, or, if said responses don't arrive in a timely manner (within verb's timeout), to expire the callbacks. Since we reuse the same request id for multiple messages now, the map is keyed by (id, peer) tuples rather than just id as it used to before 4.0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RequestCallbacks.CallbackInfo
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWithExpiration(RequestCallback<?> cb, Message<?> message, InetAddressAndPort to)
Register the providedRequestCallback
, inferring expiry and id from the providedMessage
.void
addWithExpiration(AbstractWriteResponseHandler<?> cb, Message<?> message, Replica to)
static long
defaultExpirationInterval()
void
onDiscardOnClose(Message<?> message, InetAddressAndPort peer)
void
onExpired(Message<?> message, InetAddressAndPort peer)
void
onFailedSerialize(Message<?> message, InetAddressAndPort peer, int messagingVersion, int bytesWrittenToNetwork, java.lang.Throwable failure)
void
onOverloaded(Message<?> message, InetAddressAndPort peer)
RequestCallbacks.CallbackInfo
remove(long id, InetAddressAndPort peer)
Remove and return theRequestCallbacks.CallbackInfo
associated with given id and peer, if known.void
removeAndRespond(long id, InetAddressAndPort peer, Message message)
void
unsafeClear()
-
-
-
Method Detail
-
remove
@Nullable public RequestCallbacks.CallbackInfo remove(long id, InetAddressAndPort peer)
Remove and return theRequestCallbacks.CallbackInfo
associated with given id and peer, if known.
-
addWithExpiration
public void addWithExpiration(RequestCallback<?> cb, Message<?> message, InetAddressAndPort to)
Register the providedRequestCallback
, inferring expiry and id from the providedMessage
.
-
addWithExpiration
public void addWithExpiration(AbstractWriteResponseHandler<?> cb, Message<?> message, Replica to)
-
removeAndRespond
public void removeAndRespond(long id, InetAddressAndPort peer, Message message)
-
unsafeClear
public void unsafeClear()
-
onOverloaded
public void onOverloaded(Message<?> message, InetAddressAndPort peer)
-
onExpired
public void onExpired(Message<?> message, InetAddressAndPort peer)
-
onFailedSerialize
public void onFailedSerialize(Message<?> message, InetAddressAndPort peer, int messagingVersion, int bytesWrittenToNetwork, java.lang.Throwable failure)
-
onDiscardOnClose
public void onDiscardOnClose(Message<?> message, InetAddressAndPort peer)
-
defaultExpirationInterval
public static long defaultExpirationInterval()
-
-