Package google.registry.proxy.handler
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
Modifier and TypeClassDescriptionstatic 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
Modifier and TypeFieldDescriptionprotected final FrontendMetrics
protected final QuotaManager
protected QuotaManager.QuotaResponse
-
Constructor Summary
ModifierConstructorDescriptionprotected
QuotaHandler
(QuotaManager quotaManager, FrontendMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionabstract 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
-
quotaManager
-
quotaResponse
-
metrics
-
-
Constructor Details
-
QuotaHandler
-
-
Method Details
-
channelRead
- Specified by:
channelRead
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelRead
in classio.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 interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
-