/** * Track latency information for the dynamic snitch * * @param cb the callback associated with this message -- this lets us know if it's a message type we're interested in * @param address the host that replied to the message * @param latency */ public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency) { if (cb.isLatencyForSnitch()) addLatency(address, latency); }
cb.response(message); if (callbackInfo.callback.supportsBackPressure())
/** * Updates the back-pressure state on sending to the given host if enabled and the given message callback supports it. * * @param host The replica host the back-pressure state refers to. * @param callback The message callback. * @param message The actual message. */ public void updateBackPressureOnSend(InetAddress host, IAsyncCallback callback, MessageOut<?> message) { if (DatabaseDescriptor.backPressureEnabled() && callback.supportsBackPressure()) { BackPressureState backPressureState = getConnectionPool(host).getBackPressureState(); backPressureState.onMessageSent(message); } }
public void doVerb(MessageIn message, int id) { long latency = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - MessagingService.instance().getRegisteredCallbackAge(id)); CallbackInfo callbackInfo = MessagingService.instance().removeRegisteredCallback(id); if (callbackInfo == null) { String msg = "Callback already removed for {} (from {})"; logger.debug(msg, id, message.from); Tracing.trace(msg, id, message.from); return; } Tracing.trace("Processing response from {}", message.from); IAsyncCallback cb = callbackInfo.callback; if (message.isFailureResponse()) { ((IAsyncCallbackWithFailure) cb).onFailure(message.from); } else { //TODO: Should we add latency only in success cases? MessagingService.instance().maybeAddLatency(cb, message.from, latency); cb.response(message); } } }
cb.response(message); if (callbackInfo.callback.supportsBackPressure())
/** * Updates the back-pressure state on sending to the given host if enabled and the given message callback supports it. * * @param host The replica host the back-pressure state refers to. * @param callback The message callback. * @param message The actual message. */ public void updateBackPressureOnSend(InetAddress host, IAsyncCallback callback, MessageOut<?> message) { if (DatabaseDescriptor.backPressureEnabled() && callback.supportsBackPressure()) { BackPressureState backPressureState = getConnectionPool(host).getBackPressureState(); backPressureState.onMessageSent(message); } }
cb.response(message); if (callbackInfo.callback.supportsBackPressure())
/** * Track latency information for the dynamic snitch * * @param cb the callback associated with this message -- this lets us know if it's a message type we're interested in * @param address the host that replied to the message * @param latency */ public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency) { if (cb.isLatencyForSnitch()) addLatency(address, latency); }
/** * Updates the back-pressure state on sending to the given host if enabled and the given message callback supports it. * * @param host The replica host the back-pressure state refers to. * @param callback The message callback. * @param message The actual message. */ public void updateBackPressureOnSend(InetAddress host, IAsyncCallback callback, MessageOut<?> message) { if (DatabaseDescriptor.backPressureEnabled() && callback.supportsBackPressure()) { BackPressureState backPressureState = getConnectionPool(host).getBackPressureState(); backPressureState.onMessageSent(message); } }
/** * Track latency information for the dynamic snitch * * @param cb the callback associated with this message -- this lets us know if it's a message type we're interested in * @param address the host that replied to the message * @param latency */ public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency) { if (cb.isLatencyForSnitch()) addLatency(address, latency); }
/** * Updates the back-pressure state on reception from the given host if enabled and the given message callback supports it. * * @param host The replica host the back-pressure state refers to. * @param callback The message callback. * @param timeout True if updated following a timeout, false otherwise. */ public void updateBackPressureOnReceive(InetAddress host, IAsyncCallback callback, boolean timeout) { if (DatabaseDescriptor.backPressureEnabled() && callback.supportsBackPressure()) { BackPressureState backPressureState = getConnectionPool(host).getBackPressureState(); if (!timeout) backPressureState.onResponseReceived(); else backPressureState.onResponseTimeout(); } }
/** * Track latency information for the dynamic snitch * * @param cb the callback associated with this message -- this lets us know if it's a message type we're interested in * @param address the host that replied to the message * @param latency */ public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency) { if (cb.isLatencyForSnitch()) addLatency(address, latency); }
/** * Updates the back-pressure state on reception from the given host if enabled and the given message callback supports it. * * @param host The replica host the back-pressure state refers to. * @param callback The message callback. * @param timeout True if updated following a timeout, false otherwise. */ public void updateBackPressureOnReceive(InetAddress host, IAsyncCallback callback, boolean timeout) { if (DatabaseDescriptor.backPressureEnabled() && callback.supportsBackPressure()) { BackPressureState backPressureState = getConnectionPool(host).getBackPressureState(); if (!timeout) backPressureState.onResponseReceived(); else backPressureState.onResponseTimeout(); } }
/** * Updates the back-pressure state on reception from the given host if enabled and the given message callback supports it. * * @param host The replica host the back-pressure state refers to. * @param callback The message callback. * @param timeout True if updated following a timeout, false otherwise. */ public void updateBackPressureOnReceive(InetAddress host, IAsyncCallback callback, boolean timeout) { if (DatabaseDescriptor.backPressureEnabled() && callback.supportsBackPressure()) { BackPressureState backPressureState = getConnectionPool(host).getBackPressureState(); if (!timeout) backPressureState.onResponseReceived(); else backPressureState.onResponseTimeout(); } }