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
ConstructorDescriptionRouter4Impl
(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.ServerBootstrap
protected <H,
P extends ResourcePath<K>, K, R>
Router4PipelineFactory<C>constructRouterPipelineFactory
(ScatterGatherRequestHandler4<H, P, K, R> scatterGatherRequestHandler) int
int
io.netty.util.Timer
long
boolean
static boolean
isBusyAutoReadDisable
(Router router) boolean
Returns true if this resource has been shut down.boolean
Returns true if the resource has completed shutting down.setAcceptConnection
(boolean enabled) void
setBusyAutoReadDisable
(boolean busyAutoReadDisable) static void
setBusyAutoReadDisable
(Router router, boolean busyAutoReadDisable) void
setPipelineSupplier
(Supplier<Router4PipelineFactory<C>> pipelineSupplier) void
shutdown()
Starts the shutdown process.start
(SocketAddress address) void
Waits for shutdown to completevoid
waitForShutdown
(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:
nettyVersion
in interfaceRouter
-
bootstrap
protected io.netty.bootstrap.ServerBootstrap bootstrap() -
start
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceRouter
-
setAcceptConnection
- Specified by:
setAcceptConnection
in interfaceRouter
-
getConnectedCount
public int getConnectedCount()- Specified by:
getConnectedCount
in interfaceRouter
-
getActiveStreams
public int getActiveStreams()- Specified by:
getActiveStreams
in interfaceRouter
-
getRstErrorCount
public long getRstErrorCount()- Specified by:
getRstErrorCount
in 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:
isShutdown
in 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:
isTerminated
in 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:
shutdown
in interfaceShutdownable
-
waitForShutdown
Waits for shutdown to complete- Specified by:
waitForShutdown
in 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:
waitForShutdown
in 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
-