public class ShuffleChannelHandler
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
Example Request =================== GET /mapOutput?job=job_1111111111111_0001&reduce=0& map=attempt_1111111111111_0001_m_000001_0, attempt_1111111111111_0002_m_000002_0, attempt_1111111111111_0003_m_000003_0 HTTP/1.1 name: mapreduce version: 1.0.0 UrlHash: 9zS++qE0/7/D2l1Rg0TqRoSguAk= Example Response =================== HTTP/1.1 200 OK ReplyHash: GcuojWkAxXUyhZHPnwoV/MW2tGA= name: mapreduce version: 1.0.0 connection: close content-length: 138 +--------+-------------------------------------------------+----------------+ |00000000| 25 61 74 74 65 6d 70 74 5f 31 31 31 31 31 31 31 |%attempt_1111111| |00000010| 31 31 31 31 31 31 5f 30 30 30 31 5f 6d 5f 30 30 |111111_0001_m_00| |00000020| 30 30 30 31 5f 30 05 0a 00 |0001_0... | +--------+-------------------------------------------------+----------------+ |00000000| 61 61 61 61 61 |aaaaa | +--------+-------------------------------------------------+----------------+ |00000000| 25 61 74 74 65 6d 70 74 5f 31 31 31 31 31 31 31 |%attempt_1111111| |00000010| 31 31 31 31 31 31 5f 30 30 30 32 5f 6d 5f 30 30 |111111_0002_m_00| |00000020| 30 30 30 32 5f 30 05 0a 00 |0002_0... | +--------+-------------------------------------------------+----------------+ |00000000| 62 62 62 62 62 |bbbbb | +--------+-------------------------------------------------+----------------+ |00000000| 25 61 74 74 65 6d 70 74 5f 31 31 31 31 31 31 31 |%attempt_1111111| |00000010| 31 31 31 31 31 31 5f 30 30 30 33 5f 6d 5f 30 30 |111111_0003_m_00| |00000020| 30 30 30 33 5f 30 05 0a 00 |0003_0... | +--------+-------------------------------------------------+----------------+ |00000000| 63 63 63 63 63 |ccccc | +--------+-------------------------------------------------+----------------+
Modifier and Type | Class and Description |
---|---|
static class |
ShuffleChannelHandler.ReduceContext
Maintain parameters per messageReceived() Netty context.
|
Modifier and Type | Method and Description |
---|---|
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpRequest request) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
protected org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo |
getMapOutputInfo(String mapId,
int reduce,
String jobId,
String user) |
protected void |
populateHeaders(List<String> mapIds,
String jobId,
String user,
int reduce,
io.netty.handler.codec.http.HttpResponse response,
boolean keepAliveParam,
Map<String,org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo> mapOutputInfoMap) |
protected void |
sendError(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpResponseStatus status) |
protected void |
sendError(io.netty.channel.ChannelHandlerContext ctx,
String message,
io.netty.handler.codec.http.HttpResponseStatus status) |
protected void |
sendError(io.netty.channel.ChannelHandlerContext ctx,
String msg,
io.netty.handler.codec.http.HttpResponseStatus status,
Map<String,String> headers) |
void |
sendMap(ShuffleChannelHandler.ReduceContext reduceContext)
Calls sendMapOutput for the mapId pointed by ReduceContext.mapsToSend
and increments it.
|
protected io.netty.channel.ChannelFuture |
sendMapOutput(io.netty.channel.Channel ch,
String user,
String mapId,
int reduce,
org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo mapOutputInfo) |
protected void |
setResponseHeaders(io.netty.handler.codec.http.HttpResponse response,
boolean keepAliveParam,
long contentLength) |
static io.netty.buffer.ByteBuf |
shuffleHeaderToBytes(org.apache.hadoop.mapreduce.task.reduce.ShuffleHeader header) |
protected void |
verifyRequest(String appid,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request,
io.netty.handler.codec.http.HttpResponse response,
URL requestUri) |
acceptInboundMessage, channelRead
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelActive
in interface io.netty.channel.ChannelInboundHandler
channelActive
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request)
channelRead0
in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
public void sendMap(ShuffleChannelHandler.ReduceContext reduceContext)
reduceContext
- used to call sendMapOutput with correct params.protected org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo getMapOutputInfo(String mapId, int reduce, String jobId, String user) throws IOException
IOException
protected void populateHeaders(List<String> mapIds, String jobId, String user, int reduce, io.netty.handler.codec.http.HttpResponse response, boolean keepAliveParam, Map<String,org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo> mapOutputInfoMap) throws IOException
IOException
protected void setResponseHeaders(io.netty.handler.codec.http.HttpResponse response, boolean keepAliveParam, long contentLength)
protected void verifyRequest(String appid, io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, io.netty.handler.codec.http.HttpResponse response, URL requestUri) throws IOException
IOException
public static io.netty.buffer.ByteBuf shuffleHeaderToBytes(org.apache.hadoop.mapreduce.task.reduce.ShuffleHeader header) throws IOException
IOException
protected io.netty.channel.ChannelFuture sendMapOutput(io.netty.channel.Channel ch, String user, String mapId, int reduce, org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo mapOutputInfo) throws IOException
IOException
protected void sendError(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpResponseStatus status)
protected void sendError(io.netty.channel.ChannelHandlerContext ctx, String message, io.netty.handler.codec.http.HttpResponseStatus status)
protected void sendError(io.netty.channel.ChannelHandlerContext ctx, String msg, io.netty.handler.codec.http.HttpResponseStatus status, Map<String,String> headers)
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.