io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandlerpublic 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 | Description |
|---|---|---|
static class |
ShuffleChannelHandler.ReduceContext |
Maintain parameters per messageReceived() Netty context.
|
| Modifier and Type | Method | 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,
java.lang.Throwable cause) |
|
protected org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo |
getMapOutputInfo(java.lang.String mapId,
int reduce,
java.lang.String jobId,
java.lang.String user) |
|
protected void |
populateHeaders(java.util.List<java.lang.String> mapIds,
java.lang.String jobId,
java.lang.String user,
int reduce,
io.netty.handler.codec.http.HttpResponse response,
boolean keepAliveParam,
java.util.Map<java.lang.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,
java.lang.String message,
io.netty.handler.codec.http.HttpResponseStatus status) |
|
protected void |
sendError(io.netty.channel.ChannelHandlerContext ctx,
java.lang.String msg,
io.netty.handler.codec.http.HttpResponseStatus status,
java.util.Map<java.lang.String,java.lang.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,
java.lang.String user,
java.lang.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(java.lang.String appid,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request,
io.netty.handler.codec.http.HttpResponse response,
java.net.URL requestUri) |
acceptInboundMessage, channelReadchannelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharablepublic void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws java.lang.Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws java.lang.Exception
channelInactive in interface io.netty.channel.ChannelInboundHandlerchannelInactive in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exceptionpublic 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(java.lang.String mapId,
int reduce,
java.lang.String jobId,
java.lang.String user)
throws java.io.IOException
java.io.IOExceptionprotected void populateHeaders(java.util.List<java.lang.String> mapIds,
java.lang.String jobId,
java.lang.String user,
int reduce,
io.netty.handler.codec.http.HttpResponse response,
boolean keepAliveParam,
java.util.Map<java.lang.String,org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo> mapOutputInfoMap)
throws java.io.IOException
java.io.IOExceptionprotected void setResponseHeaders(io.netty.handler.codec.http.HttpResponse response,
boolean keepAliveParam,
long contentLength)
protected void verifyRequest(java.lang.String appid,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest request,
io.netty.handler.codec.http.HttpResponse response,
java.net.URL requestUri)
throws java.io.IOException
java.io.IOExceptionpublic static io.netty.buffer.ByteBuf shuffleHeaderToBytes(org.apache.hadoop.mapreduce.task.reduce.ShuffleHeader header)
throws java.io.IOException
java.io.IOExceptionprotected io.netty.channel.ChannelFuture sendMapOutput(io.netty.channel.Channel ch,
java.lang.String user,
java.lang.String mapId,
int reduce,
org.apache.hadoop.mapred.ShuffleChannelHandler.MapOutputInfo mapOutputInfo)
throws java.io.IOException
java.io.IOExceptionprotected void sendError(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpResponseStatus status)
protected void sendError(io.netty.channel.ChannelHandlerContext ctx,
java.lang.String message,
io.netty.handler.codec.http.HttpResponseStatus status)
protected void sendError(io.netty.channel.ChannelHandlerContext ctx,
java.lang.String msg,
io.netty.handler.codec.http.HttpResponseStatus status,
java.util.Map<java.lang.String,java.lang.String> headers)
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Throwable cause)
throws java.lang.Exception
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterjava.lang.ExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.