Class RateLimitHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
com.hypixel.hytale.server.core.io.netty.RateLimitHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class RateLimitHandler extends io.netty.channel.ChannelInboundHandlerAdapter
  • Nested Class Summary

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

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

    Fields
    Modifier and Type
    Field
    Description
    private long
     
    private static final com.hypixel.hytale.logger.HytaleLogger
     
    private final int
     
    private final int
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RateLimitHandler(int maxTokens, int refillRate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    private void
     

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, 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

    • LOGGER

      private static final com.hypixel.hytale.logger.HytaleLogger LOGGER
    • maxTokens

      private final int maxTokens
    • refillRate

      private final int refillRate
    • tokens

      private int tokens
    • lastRefillTime

      private long lastRefillTime
  • Constructor Details

    • RateLimitHandler

      public RateLimitHandler(int maxTokens, int refillRate)
  • Method Details

    • refillTokens

      private void refillTokens()
    • channelRead

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