mirror of https://github.com/grpc/grpc-java.git
netty: fix visibility issues with InternalNettySocketSupport (#4335)
Previous version is not actually extendable from other packages.
This commit is contained in:
parent
03465a7f45
commit
c50a57cd52
|
|
@ -17,6 +17,8 @@
|
|||
package io.grpc.netty;
|
||||
|
||||
import io.grpc.Internal;
|
||||
import io.grpc.internal.Channelz.TcpInfo;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An internal accessor. Do not use.
|
||||
|
|
@ -24,7 +26,17 @@ import io.grpc.Internal;
|
|||
@Internal
|
||||
public final class InternalNettySocketSupport {
|
||||
|
||||
public interface InternalHelper extends NettySocketSupport.Helper { }
|
||||
public interface InternalHelper extends NettySocketSupport.Helper {
|
||||
@Override
|
||||
InternalNativeSocketOptions getNativeSocketOptions(io.netty.channel.Channel ch);
|
||||
}
|
||||
|
||||
public static final class InternalNativeSocketOptions
|
||||
extends NettySocketSupport.NativeSocketOptions {
|
||||
public InternalNativeSocketOptions(TcpInfo tcpInfo, Map<String, String> otherInfo) {
|
||||
super(tcpInfo, otherInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setHelper(InternalHelper helper) {
|
||||
NettySocketSupport.setHelper(helper);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import javax.annotation.Nullable;
|
|||
* An class for getting low level socket info.
|
||||
*/
|
||||
final class NettySocketSupport {
|
||||
private static volatile Helper INSTANCE = new NettySocketHelperImpl();
|
||||
private static volatile Helper instance = new NettySocketHelperImpl();
|
||||
|
||||
interface Helper {
|
||||
/**
|
||||
|
|
@ -40,7 +40,7 @@ final class NettySocketSupport {
|
|||
/**
|
||||
* A TcpInfo and additional other info that will be turned into channelz socket options.
|
||||
*/
|
||||
public static final class NativeSocketOptions {
|
||||
public static class NativeSocketOptions {
|
||||
@Nullable
|
||||
public final TcpInfo tcpInfo;
|
||||
public final ImmutableMap<String, String> otherInfo;
|
||||
|
|
@ -56,11 +56,11 @@ final class NettySocketSupport {
|
|||
}
|
||||
|
||||
public static NativeSocketOptions getNativeSocketOptions(Channel ch) {
|
||||
return INSTANCE.getNativeSocketOptions(ch);
|
||||
return instance.getNativeSocketOptions(ch);
|
||||
}
|
||||
|
||||
static void setHelper(Helper helper) {
|
||||
INSTANCE = Preconditions.checkNotNull(helper);
|
||||
instance = Preconditions.checkNotNull(helper);
|
||||
}
|
||||
|
||||
private static final class NettySocketHelperImpl implements Helper {
|
||||
|
|
|
|||
Loading…
Reference in New Issue