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

    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

    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

      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 interface io.netty.channel.ChannelOutboundHandler
      Overrides:
      write in class io.netty.channel.ChannelOutboundHandlerAdapter