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
FieldsModifier and TypeFieldDescriptionprivate longprivate static final com.hypixel.hytale.logger.HytaleLoggerprivate final intprivate final intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) private voidMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter
-