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
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Constructor Summary
ConstructorDescriptionBlacklistHandler
(long blacklistTtlMs, int failCountThreshold) BlacklistHandler
(long blacklistTtlMs, int failCountThreshold, Clock clock) -
Method Summary
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
exceptionCaught, handlerAdded, handlerRemoved
-
Constructor Details
-
BlacklistHandler
-
BlacklistHandler
public BlacklistHandler(long blacklistTtlMs, int failCountThreshold)
-
-
Method Details
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) - Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.channel.ChannelOutboundHandlerAdapter
-