public class WeightedStatsRequestInterceptor extends BaseWeightedStats implements RequestInterceptor
RequestInterceptor that hooks into request lifecycle and calls methods of the parent
class to manage tracking state and expose WeightedStats.
This interceptor the default mechanism for gathering stats when WeightedLoadbalanceStrategy is used with LoadbalanceRSocketClient.
LoadbalanceRSocketClient,
WeightedLoadbalanceStrategyDisposable.Composite, Disposable.Swap| Constructor and Description |
|---|
WeightedStatsRequestInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
void |
onCancel(int streamId,
FrameType requestType)
Method which is being invoked once a successfully accepted request is cancelled.
|
void |
onReject(Throwable rejectionReason,
FrameType requestType,
ByteBuf metadata)
Method which is being invoked on the request rejection.
|
void |
onStart(int streamId,
FrameType requestType,
ByteBuf metadata)
Method which is being invoked on successful acceptance and start of a request.
|
void |
onTerminate(int streamId,
FrameType requestType,
Throwable t)
Method which is being invoked once a successfully accepted request is terminated.
|
higherQuantileLatency, lowerQuantileLatency, pending, predictedLatency, toString, weightedAvailabilityclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisDisposedwrappublic final void onStart(int streamId,
FrameType requestType,
@Nullable
ByteBuf metadata)
RequestInterceptoronStart in interface RequestInterceptorstreamId - used for the requestrequestType - of the request. Must be one of the following types FrameType.REQUEST_FNF, FrameType.REQUEST_RESPONSE, FrameType.REQUEST_STREAM or FrameType.REQUEST_CHANNELmetadata - taken from the initial framepublic final void onTerminate(int streamId,
FrameType requestType,
@Nullable
Throwable t)
RequestInterceptorRequestInterceptor.onStart(int, FrameType, ByteBuf) method. This method is
exclusive with RequestInterceptor.onCancel(int, FrameType).onTerminate in interface RequestInterceptorstreamId - used by this requestrequestType - of the request. Must be one of the following types FrameType.REQUEST_FNF, FrameType.REQUEST_RESPONSE, FrameType.REQUEST_STREAM or FrameType.REQUEST_CHANNELt - with which this finished has terminated. Must be one of the following signalspublic final void onCancel(int streamId,
FrameType requestType)
RequestInterceptorRequestInterceptor.onStart(int, FrameType, ByteBuf) method. This method is
exclusive with RequestInterceptor.onTerminate(int, FrameType, Throwable).onCancel in interface RequestInterceptorstreamId - used by this requestrequestType - of the request. Must be one of the following types FrameType.REQUEST_FNF, FrameType.REQUEST_RESPONSE, FrameType.REQUEST_STREAM or FrameType.REQUEST_CHANNELpublic final void onReject(Throwable rejectionReason, FrameType requestType, ByteBuf metadata)
RequestInterceptorRequestInterceptor.onStart(int, FrameType,
ByteBuf) method. The reason for rejection can be one of the following:
onReject in interface RequestInterceptorrejectionReason - exception which causes rejection of a particular requestrequestType - of the request. Must be one of the following types FrameType.REQUEST_FNF, FrameType.REQUEST_RESPONSE, FrameType.REQUEST_STREAM or FrameType.REQUEST_CHANNELmetadata - taken from the initial framepublic void dispose()
dispose in interface Disposable