Class ScatterGatherHelper<H,​P extends ResourcePath<K>,​K,​R,​BASIC_HTTP_REQUEST extends BasicRequest,​HTTP_RESPONSE,​HTTP_RESPONSE_STATUS>


  • public class ScatterGatherHelper<H,​P extends ResourcePath<K>,​K,​R,​BASIC_HTTP_REQUEST extends BasicRequest,​HTTP_RESPONSE,​HTTP_RESPONSE_STATUS>
    extends java.lang.Object
    • Method Detail

      • forEachBeforeHttpServerCodec

        public void forEachBeforeHttpServerCodec​(@Nonnull
                                                 java.util.function.Consumer<Pair<java.lang.String,​?>> consumer)
      • forEachBeforeChunkAggregator

        public void forEachBeforeChunkAggregator​(@Nonnull
                                                 java.util.function.Consumer<Pair<java.lang.String,​?>> consumer)
      • forEachBeforeIdleStateHandler

        public void forEachBeforeIdleStateHandler​(@Nonnull
                                                  java.util.function.Consumer<Pair<java.lang.String,​?>> consumer)
      • forEachBeforeHttpRequestHandler

        public void forEachBeforeHttpRequestHandler​(@Nonnull
                                                    java.util.function.Consumer<Pair<java.lang.String,​?>> consumer)
      • isHostHealthy

        public final boolean isHostHealthy​(@Nonnull
                                           H hostName,
                                           @Nonnull
                                           java.lang.String partitionName)
        To check if a host is healthy/responsive.
        Parameters:
        hostName - the host name, including the service port
        Returns:
        the host is healthy or not
      • getLongTailRetryMilliseconds

        public final AsyncFuture<java.util.function.LongSupplier> getLongTailRetryMilliseconds​(P path,
                                                                                               java.lang.String methodName)
      • getLongTailRetryMilliseconds

        public final AsyncFuture<java.util.function.LongSupplier> getLongTailRetryMilliseconds​(P path,
                                                                                               BasicRequest request)
      • dispatcherNettyVersion

        public Netty dispatcherNettyVersion()
      • findPartitionName

        public java.util.concurrent.CompletionStage<java.lang.String> findPartitionName​(java.lang.String resourceName,
                                                                                        K key)
      • getRequestTimeout

        public long getRequestTimeout​(@Nonnull
                                      Headers headers)
      • getDefaultTimeoutMillis

        public long getDefaultTimeoutMillis()
      • setDefaultTimeoutMillis

        public void setDefaultTimeoutMillis​(long timeoutMillis)
      • getDispatchMinimumMillis

        public long getDispatchMinimumMillis()
      • setDispatchMinimumMillis

        public void setDispatchMinimumMillis​(long value)
      • getLongTailMinimumMillis

        public long getLongTailMinimumMillis()
      • setLongTailMinimumMillis

        public void setLongTailMinimumMillis​(long value)
      • isEnableStackTraceResponseForException

        public boolean isEnableStackTraceResponseForException()
      • isEnableRetryRequestAlwaysUseADifferentHost

        public boolean isEnableRetryRequestAlwaysUseADifferentHost()
      • disableRetryOnTimeout

        public boolean disableRetryOnTimeout()
      • isReqRedirectionAllowedForQuery

        public boolean isReqRedirectionAllowedForQuery()
      • decorateResponse

        public void decorateResponse​(@Nonnull
                                     Headers responseHeaders,
                                     @Nonnull
                                     Headers requestHeaders,
                                     Metrics metrics)
      • responseMetrics

        public Metrics responseMetrics​(@Nonnull
                                       Headers headers)
      • getScatterGatherStatsByPath

        @Nonnull
        public ScatterGatherStats getScatterGatherStatsByPath​(P path)
      • isSuccessStatus

        public boolean isSuccessStatus​(int code)
      • isRequestRetriable

        public boolean isRequestRetriable​(@Nonnull
                                          P path,
                                          @Nonnull
                                          R role,
                                          @Nonnull
                                          HTTP_RESPONSE_STATUS status)
      • parseRoles

        public R parseRoles​(@Nonnull
                            java.lang.String requestMethod,
                            @Nonnull
                            Headers headers)