Class Router4Impl<C extends io.netty.channel.Channel>
java.lang.Object
com.linkedin.alpini.router.impl.netty4.Router4Impl<C>
- All Implemented Interfaces:
ResourceRegistry.Sync,Shutdownable,ShutdownableResource,Router
public class Router4Impl<C extends io.netty.channel.Channel>
extends Object
implements Router, ResourceRegistry.Sync
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.linkedin.alpini.router.impl.Router
Router.Builder, Router.PipelineFactory<CHANNEL_HANDLER> -
Constructor Summary
ConstructorsConstructorDescriptionRouter4Impl(String name, Class<? extends io.netty.channel.socket.ServerSocketChannel> channelClass, io.netty.channel.EventLoopGroup bossPool, io.netty.channel.EventLoopGroup workerPool, io.netty.util.concurrent.EventExecutor workerExecutor, ConnectionLimitHandler connectionLimit, ActiveStreamsCountHandler activeStreamsCountHandler, Http2SettingsFrameLogger http2SettingsFrameLogger, RouterTimeoutProcessor timeoutProcessor, io.netty.util.Timer nettyTimer, Map<String, Object> serverSocketOptions, ScatterGatherHelper<H, P, K, R, BasicFullHttpRequest, io.netty.handler.codec.http.FullHttpResponse, io.netty.handler.codec.http.HttpResponseStatus> scatterGatherHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected io.netty.bootstrap.ServerBootstrapprotected <H,P extends ResourcePath<K>, K, R>
Router4PipelineFactory<C>constructRouterPipelineFactory(ScatterGatherRequestHandler4<H, P, K, R> scatterGatherRequestHandler) intintio.netty.util.Timerlongbooleanstatic booleanisBusyAutoReadDisable(Router router) booleanReturns true if this resource has been shut down.booleanReturns true if the resource has completed shutting down.setAcceptConnection(boolean enabled) voidsetBusyAutoReadDisable(boolean busyAutoReadDisable) static voidsetBusyAutoReadDisable(Router router, boolean busyAutoReadDisable) voidsetPipelineSupplier(Supplier<Router4PipelineFactory<C>> pipelineSupplier) voidshutdown()Starts the shutdown process.start(SocketAddress address) voidWaits for shutdown to completevoidwaitForShutdown(long timeoutInMs) Waits for shutdown to complete with a timeout
-
Constructor Details
-
Router4Impl
public Router4Impl(String name, Class<? extends io.netty.channel.socket.ServerSocketChannel> channelClass, io.netty.channel.EventLoopGroup bossPool, io.netty.channel.EventLoopGroup workerPool, io.netty.util.concurrent.EventExecutor workerExecutor, ConnectionLimitHandler connectionLimit, ActiveStreamsCountHandler activeStreamsCountHandler, Http2SettingsFrameLogger http2SettingsFrameLogger, RouterTimeoutProcessor timeoutProcessor, io.netty.util.Timer nettyTimer, Map<String, Object> serverSocketOptions, @Nonnull ScatterGatherHelper<H, P, K, R, BasicFullHttpRequest, io.netty.handler.codec.http.FullHttpResponse, io.netty.handler.codec.http.HttpResponseStatus> scatterGatherHelper)
-
-
Method Details
-
getPipelineSupplier
-
setPipelineSupplier
-
constructRouterPipelineFactory
protected <H,P extends ResourcePath<K>, Router4PipelineFactory<C> constructRouterPipelineFactoryK, R> (@Nonnull ScatterGatherRequestHandler4<H, P, K, R> scatterGatherRequestHandler) -
nettyVersion
- Specified by:
nettyVersionin interfaceRouter
-
bootstrap
protected io.netty.bootstrap.ServerBootstrap bootstrap() -
start
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceRouter
-
setAcceptConnection
- Specified by:
setAcceptConnectionin interfaceRouter
-
getConnectedCount
public int getConnectedCount()- Specified by:
getConnectedCountin interfaceRouter
-
getActiveStreams
public int getActiveStreams()- Specified by:
getActiveStreamsin interfaceRouter
-
getRstErrorCount
public long getRstErrorCount()- Specified by:
getRstErrorCountin interfaceRouter
-
isBusyAutoReadDisable
public boolean isBusyAutoReadDisable() -
setBusyAutoReadDisable
public void setBusyAutoReadDisable(boolean busyAutoReadDisable) -
setBusyAutoReadDisable
-
isBusyAutoReadDisable
-
isShutdown
public boolean isShutdown()Returns true if this resource has been shut down.- Specified by:
isShutdownin interfaceShutdownableResource- Returns:
- true if this resource has been shut down
-
isTerminated
public boolean isTerminated()Returns true if the resource has completed shutting down. Note that isTerminated is never true unless shutdown was called first.- Specified by:
isTerminatedin interfaceShutdownableResource- Returns:
- true if the resource has completed shutting down.
-
shutdown
public void shutdown()Starts the shutdown process. It is recommended to perform the actual shutdown activity in a separate thread from the thread that calls shutdown- Specified by:
shutdownin interfaceShutdownable
-
waitForShutdown
Waits for shutdown to complete- Specified by:
waitForShutdownin interfaceShutdownable- Throws:
InterruptedException- when the wait is interruptedIllegalStateException- when the method is invoked when the shutdown has yet to be started
-
waitForShutdown
public void waitForShutdown(long timeoutInMs) throws InterruptedException, IllegalStateException, TimeoutException Waits for shutdown to complete with a timeout- Specified by:
waitForShutdownin interfaceShutdownable- Parameters:
timeoutInMs- number of milliseconds to wait before throwing TimeoutException- Throws:
InterruptedException- when the wait is interruptedIllegalStateException- when the method is invoked when the shutdown has yet to be startedTimeoutException- when the operation times out
-
getNettyTimer
public io.netty.util.Timer getNettyTimer() -
getConnectionLimit
-
getActiveStreamsCountHandler
-
getHttp2SettingsFrameLogger
-