Package org.tinyradius.io.client.handler
Class BlacklistHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelOutboundHandlerAdapter
org.tinyradius.io.client.handler.BlacklistHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelOutboundHandler
public class BlacklistHandler
extends io.netty.channel.ChannelOutboundHandlerAdapter
ChannelOutboundHandler that adds support for blacklists after multiple failures.
Can be placed at any point where PendingRequestCtx is available, as it hooks onto the promise outcomes to catch all failure scenarios (e.g. timeouts). However, the earlier it's hooked, the sooner it can fail fast the request if the endpoint is blacklisted.
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description BlacklistHandler(long blacklistTtlMs, int failCountThreshold)
-
Method Summary
Modifier and Type Method Description void
write(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise)
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
Constructor Details
-
BlacklistHandler
public BlacklistHandler(long blacklistTtlMs, int failCountThreshold)
-
-
Method Details
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise)- Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.channel.ChannelOutboundHandlerAdapter
-