HADOOP-17858. Avoid possible class loading deadlock with VerifierNone initialization (#3321)

This commit is contained in:
Viraj Jasani 2021-08-24 19:11:59 +05:30 committed by GitHub
parent e06a5cb197
commit fc566ad9b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View File

@ -28,7 +28,6 @@
import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInboundHandlerAdapter;
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting; import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.oncrpc.RpcAcceptedReply.AcceptState; import org.apache.hadoop.oncrpc.RpcAcceptedReply.AcceptState;
import org.apache.hadoop.oncrpc.security.Verifier;
import org.apache.hadoop.oncrpc.security.VerifierNone; import org.apache.hadoop.oncrpc.security.VerifierNone;
import org.apache.hadoop.portmap.PortmapMapping; import org.apache.hadoop.portmap.PortmapMapping;
import org.apache.hadoop.portmap.PortmapRequest; import org.apache.hadoop.portmap.PortmapRequest;
@ -213,7 +212,7 @@ public boolean doPortMonitoring(SocketAddress remoteAddress) {
private void sendAcceptedReply(RpcCall call, SocketAddress remoteAddress, private void sendAcceptedReply(RpcCall call, SocketAddress remoteAddress,
AcceptState acceptState, ChannelHandlerContext ctx) { AcceptState acceptState, ChannelHandlerContext ctx) {
RpcAcceptedReply reply = RpcAcceptedReply.getInstance(call.getXid(), RpcAcceptedReply reply = RpcAcceptedReply.getInstance(call.getXid(),
acceptState, Verifier.VERIFIER_NONE); acceptState, VerifierNone.INSTANCE);
XDR out = new XDR(); XDR out = new XDR();
reply.write(out); reply.write(out);

View File

@ -27,8 +27,6 @@
*/ */
public abstract class Verifier extends RpcAuthInfo { public abstract class Verifier extends RpcAuthInfo {
public static final Verifier VERIFIER_NONE = new VerifierNone();
protected Verifier(AuthFlavor flavor) { protected Verifier(AuthFlavor flavor) {
super(flavor); super(flavor);
} }

View File

@ -24,6 +24,8 @@
/** Verifier used by AUTH_NONE. */ /** Verifier used by AUTH_NONE. */
public class VerifierNone extends Verifier { public class VerifierNone extends Verifier {
public static final Verifier INSTANCE = new VerifierNone();
public VerifierNone() { public VerifierNone() {
super(AuthFlavor.AUTH_NONE); super(AuthFlavor.AUTH_NONE);
} }