api,netty: fix MethodDescriptor and InternalKnownTransport for netty-shaded

Resolves #6765
This commit is contained in:
ZHANG Dapeng 2020-02-27 12:53:11 -08:00 committed by GitHub
parent bf2a66c8a2
commit 5677a0b723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -24,6 +24,7 @@ package io.grpc;
@Internal
public enum InternalKnownTransport {
NETTY,
NETTY_SHADED,
;
}

View File

@ -51,8 +51,7 @@ public final class MethodDescriptor<ReqT, RespT> {
// Must be set to InternalKnownTransport.values().length
// Not referenced to break the dependency.
private final AtomicReferenceArray<Object> rawMethodNames = new AtomicReferenceArray<>(1);
private final AtomicReferenceArray<Object> rawMethodNames = new AtomicReferenceArray<>(2);
/**
* Gets the cached "raw" method name for this Method Descriptor. The raw name is transport

View File

@ -54,7 +54,9 @@ import javax.annotation.Nullable;
*/
class NettyClientStream extends AbstractClientStream {
private static final InternalMethodDescriptor methodDescriptorAccessor =
new InternalMethodDescriptor(InternalKnownTransport.NETTY);
new InternalMethodDescriptor(
NettyClientTransport.class.getName().contains("grpc.netty.shaded")
? InternalKnownTransport.NETTY_SHADED : InternalKnownTransport.NETTY);
private final Sink sink = new Sink();
private final TransportState state;