-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17714][Core][test-maven][test-hadoop2.6]Avoid using ExecutorClassLoader to load Netty generated classes #16859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,15 +18,14 @@ | |
| package org.apache.spark.network.server; | ||
|
|
||
| import io.netty.channel.ChannelHandlerContext; | ||
| import io.netty.channel.SimpleChannelInboundHandler; | ||
| import io.netty.channel.ChannelInboundHandlerAdapter; | ||
| import io.netty.handler.timeout.IdleState; | ||
| import io.netty.handler.timeout.IdleStateEvent; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import org.apache.spark.network.client.TransportClient; | ||
| import org.apache.spark.network.client.TransportResponseHandler; | ||
| import org.apache.spark.network.protocol.Message; | ||
| import org.apache.spark.network.protocol.RequestMessage; | ||
| import org.apache.spark.network.protocol.ResponseMessage; | ||
| import static org.apache.spark.network.util.NettyUtils.getRemoteAddress; | ||
|
|
@@ -48,7 +47,7 @@ | |
| * on the channel for at least `requestTimeoutMs`. Note that this is duplex traffic; we will not | ||
| * timeout if the client is continuously sending but getting no responses, for simplicity. | ||
| */ | ||
| public class TransportChannelHandler extends SimpleChannelInboundHandler<Message> { | ||
| public class TransportChannelHandler extends ChannelInboundHandlerAdapter { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SimpleChannelInboundHandler also uses Javassist to generate a matcher class. Since |
||
| private static final Logger logger = LoggerFactory.getLogger(TransportChannelHandler.class); | ||
|
|
||
| private final TransportClient client; | ||
|
|
@@ -114,11 +113,13 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception { | |
| } | ||
|
|
||
| @Override | ||
| public void channelRead0(ChannelHandlerContext ctx, Message request) throws Exception { | ||
| public void channelRead(ChannelHandlerContext ctx, Object request) throws Exception { | ||
| if (request instanceof RequestMessage) { | ||
| requestHandler.handle((RequestMessage) request); | ||
| } else { | ||
| } else if (request instanceof ResponseMessage) { | ||
| responseHandler.handle((ResponseMessage) request); | ||
| } else { | ||
| ctx.fireChannelRead(request); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2599,14 +2599,10 @@ private[spark] object Utils extends Logging { | |
|
|
||
| private[util] object CallerContext extends Logging { | ||
| val callerContextSupported: Boolean = { | ||
| SparkHadoopUtil.get.conf.getBoolean("hadoop.caller.context.enabled", false) && { | ||
| SparkHadoopUtil.get.conf.getBoolean("hadoop.caller.context.enabled", true) && { | ||
|
||
| try { | ||
| // `Utils.classForName` will make `ReplSuite` fail with `ClassCircularityError` in | ||
| // master Maven build, so do not use it before resolving SPARK-17714. | ||
| // scalastyle:off classforname | ||
| Class.forName("org.apache.hadoop.ipc.CallerContext") | ||
| Class.forName("org.apache.hadoop.ipc.CallerContext$Builder") | ||
| // scalastyle:on classforname | ||
| Utils.classForName("org.apache.hadoop.ipc.CallerContext") | ||
| Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder") | ||
| true | ||
| } catch { | ||
| case _: ClassNotFoundException => | ||
|
|
@@ -2681,12 +2677,8 @@ private[spark] class CallerContext( | |
| def setCurrentContext(): Unit = { | ||
| if (CallerContext.callerContextSupported) { | ||
| try { | ||
| // `Utils.classForName` will make `ReplSuite` fail with `ClassCircularityError` in | ||
| // master Maven build, so do not use it before resolving SPARK-17714. | ||
| // scalastyle:off classforname | ||
| val callerContext = Class.forName("org.apache.hadoop.ipc.CallerContext") | ||
| val builder = Class.forName("org.apache.hadoop.ipc.CallerContext$Builder") | ||
| // scalastyle:on classforname | ||
| val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext") | ||
| val builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder") | ||
| val builderInst = builder.getConstructor(classOf[String]).newInstance(context) | ||
| val hdfsContext = builder.getMethod("build").invoke(builderInst) | ||
| callerContext.getMethod("setCurrent", callerContext).invoke(null, hdfsContext) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not really necessary (also in the other class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed