Class LeaderRetrievalHandler<T extends RestfulGateway>
- java.lang.Object
-
- org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerAdapter
-
- org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
-
- org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler<RoutedRequest>
-
- org.apache.flink.runtime.rest.handler.LeaderRetrievalHandler<T>
-
- Type Parameters:
T
- type of the leader to retrieve
- All Implemented Interfaces:
org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler
,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
AbstractHandler
,StaticFileServerHandler
@Sharable public abstract class LeaderRetrievalHandler<T extends RestfulGateway> extends org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler<RoutedRequest>
SimpleChannelInboundHandler
which encapsulates the leader retrieval logic for the REST endpoints.
-
-
Field Summary
Fields Modifier and Type Field Description protected GatewayRetriever<? extends T>
leaderRetriever
protected org.slf4j.Logger
logger
protected Map<String,String>
responseHeaders
protected Duration
timeout
-
Constructor Summary
Constructors Modifier Constructor Description protected
LeaderRetrievalHandler(GatewayRetriever<? extends T> leaderRetriever, Duration timeout, Map<String,String> responseHeaders)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
channelRead0(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest)
protected Duration
getTimeout()
protected abstract void
respondAsLeader(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, RoutedRequest request, T gateway)
-
Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
leaderRetriever
protected final GatewayRetriever<? extends T extends RestfulGateway> leaderRetriever
-
timeout
protected final Duration timeout
-
-
Method Detail
-
getTimeout
protected Duration getTimeout()
-
channelRead0
protected void channelRead0(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest)
- Specified by:
channelRead0
in classorg.apache.flink.shaded.netty4.io.netty.channel.SimpleChannelInboundHandler<RoutedRequest>
-
respondAsLeader
protected abstract void respondAsLeader(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, RoutedRequest request, T gateway) throws Exception
- Throws:
Exception
-
-