Package google.registry.proxy.handler
Class RelayHandler<I>
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<I>
google.registry.proxy.handler.RelayHandler<I>
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
RelayHandler.FullHttpRequestRelayHandler
,RelayHandler.FullHttpResponseRelayHandler
public class RelayHandler<I>
extends io.netty.channel.SimpleChannelInboundHandler<I>
Receives inbound massage of type
I
, and writes it to the relayChannel
stored in
the inbound channel's attribute.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
SpecializedRelayHandler
that takes aFullHttpRequest
as inbound payload.static class
SpecializedRelayHandler
that takes aFullHttpResponse
as inbound payload.Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Field Summary
Modifier and TypeFieldDescriptionA queue that saves messages that failed to be relayed.static final io.netty.util.AttributeKey
<io.netty.channel.Channel> Key used to retrieve the relay channel from aChannel
'sAttribute
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
channelRead0
(io.netty.channel.ChannelHandlerContext ctx, I msg) Read message of typeI
, write it as-is into the relay channel.void
exceptionCaught
(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) static void
writeToRelayChannel
(io.netty.channel.Channel channel, io.netty.channel.Channel relayChannel, Object msg, boolean retry) Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, 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
-
RELAY_BUFFER_KEY
A queue that saves messages that failed to be relayed.This queue is null for channels that should not retry on failure, i. e. backend channels.
This queue does not need to be synchronised because it is only accessed by the I/O thread of the channel, or its relay channel. Since both channels use the same EventLoop, their I/O activities are handled by the same thread.
-
RELAY_CHANNEL_KEY
public static final io.netty.util.AttributeKey<io.netty.channel.Channel> RELAY_CHANNEL_KEYKey used to retrieve the relay channel from aChannel
'sAttribute
.
-
-
Constructor Details
-
RelayHandler
-
-
Method Details
-
channelRead0
Read message of typeI
, write it as-is into the relay channel.- Specified by:
channelRead0
in classio.netty.channel.SimpleChannelInboundHandler<I>
-
exceptionCaught
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
writeToRelayChannel
public static void writeToRelayChannel(io.netty.channel.Channel channel, io.netty.channel.Channel relayChannel, Object msg, boolean retry)
-