Class QuotaHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
google.registry.proxy.handler.QuotaHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
Direct Known Subclasses:
QuotaHandler.EppQuotaHandler, QuotaHandler.WhoisQuotaHandler

public abstract class QuotaHandler extends io.netty.channel.ChannelInboundHandlerAdapter
Handler that checks quota fulfillment and terminates connection if necessary.

This handler attempts to acquire quota during the first channelRead(io.netty.channel.ChannelHandlerContext, java.lang.Object) operation, not when connection is established. The reason is that the userId used for acquiring quota is not always available when the connection is just open.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Quota Handler for EPP protocol.
    static class 
    Quota Handler for WHOIS protocol.

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final FrontendMetrics
     
    protected final QuotaManager
     
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    QuotaHandler(QuotaManager quotaManager, FrontendMetrics metrics)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
    Actions to take when the connection terminates.
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, 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

    handlerAdded, handlerRemoved
  • Field Details

  • Constructor Details

  • Method Details

    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelInactive

      public abstract void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
      Actions to take when the connection terminates.

      Depending on the quota type, the handler either returns the tokens, or does nothing.

      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter