mirror of https://github.com/grpc/grpc-java.git
core: move WithLog and LogId to io.grpc (#3813)
The channelz service must not live in io.grpc.internal, and channelz needs to be able to get the identifier of the entities it tracks. Since io.grpc can not refer to io.grpc.internal, the LogId must be moved out of internal.
This commit is contained in:
parent
bc54970128
commit
9e7a4c44be
|
|
@ -14,28 +14,31 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.grpc.internal;
|
||||
package io.grpc;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* A loggable ID, unique for the duration of the program.
|
||||
* Do not use this.
|
||||
*
|
||||
* <p>A loggable ID, unique for the duration of the program.
|
||||
*/
|
||||
public final class LogId {
|
||||
@Internal
|
||||
public final class InternalLogId {
|
||||
private static final AtomicLong idAlloc = new AtomicLong();
|
||||
|
||||
/**
|
||||
* @param tag a loggable tag associated with this tag. The ID that is allocated is guaranteed
|
||||
* to be unique and increasing, irrespective of the tag.
|
||||
*/
|
||||
public static LogId allocate(String tag) {
|
||||
return new LogId(tag, idAlloc.incrementAndGet());
|
||||
public static InternalLogId allocate(String tag) {
|
||||
return new InternalLogId(tag, idAlloc.incrementAndGet());
|
||||
}
|
||||
|
||||
private final String tag;
|
||||
private final long id;
|
||||
|
||||
private LogId(String tag, long id) {
|
||||
private InternalLogId(String tag, long id) {
|
||||
this.tag = tag;
|
||||
this.id = id;
|
||||
}
|
||||
|
|
@ -14,12 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.grpc.internal;
|
||||
package io.grpc;
|
||||
|
||||
/**
|
||||
* An object that has an ID that is unique within the JVM, primarily for debug logging.
|
||||
* Do not use this.
|
||||
*
|
||||
* <p>An object that has an ID that is unique within the JVM, primarily for debug logging.
|
||||
*/
|
||||
public interface WithLogId {
|
||||
@Internal
|
||||
public interface InternalWithLogId {
|
||||
/**
|
||||
* Returns an ID that is primarily used in debug logs. It usually contains the class name and a
|
||||
* numeric ID that is unique among the instances.
|
||||
|
|
@ -27,5 +30,5 @@ public interface WithLogId {
|
|||
* <p>The subclasses of this interface usually want to include the log ID in their {@link
|
||||
* #toString} results.
|
||||
*/
|
||||
LogId getLogId();
|
||||
InternalLogId getLogId();
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ import io.grpc.Compressor;
|
|||
import io.grpc.Decompressor;
|
||||
import io.grpc.DecompressorRegistry;
|
||||
import io.grpc.Grpc;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
|
|
@ -33,7 +34,6 @@ import io.grpc.Status;
|
|||
import io.grpc.internal.ClientStream;
|
||||
import io.grpc.internal.ClientStreamListener;
|
||||
import io.grpc.internal.ConnectionClientTransport;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.internal.ManagedClientTransport;
|
||||
import io.grpc.internal.NoopClientStream;
|
||||
import io.grpc.internal.ObjectPool;
|
||||
|
|
@ -63,7 +63,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
|||
final class InProcessTransport implements ServerTransport, ConnectionClientTransport {
|
||||
private static final Logger log = Logger.getLogger(InProcessTransport.class.getName());
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final String name;
|
||||
private final String authority;
|
||||
private ObjectPool<ScheduledExecutorService> serverSchedulerPool;
|
||||
|
|
@ -206,7 +206,7 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.Context;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.LoadBalancer.PickResult;
|
||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||
|
|
@ -48,7 +49,7 @@ import javax.annotation.concurrent.GuardedBy;
|
|||
* thus the delayed transport stops owning the stream.
|
||||
*/
|
||||
final class DelayedClientTransport implements ManagedClientTransport {
|
||||
private final LogId lodId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId lodId = InternalLogId.allocate(getClass().getName());
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
|
|
@ -389,7 +390,7 @@ final class DelayedClientTransport implements ManagedClientTransport {
|
|||
|
||||
// TODO(carl-mastrangelo): remove this once the Subchannel change is in.
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return lodId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package io.grpc.internal;
|
|||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import io.grpc.Attributes;
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
|
|
@ -54,7 +55,7 @@ abstract class ForwardingConnectionClientTransport implements ConnectionClientTr
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return delegate().getLogId();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import com.google.errorprone.annotations.ForOverride;
|
|||
import io.grpc.ConnectivityState;
|
||||
import io.grpc.ConnectivityStateInfo;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.Status;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -48,10 +50,10 @@ import javax.annotation.concurrent.ThreadSafe;
|
|||
* Transports for a single {@link SocketAddress}.
|
||||
*/
|
||||
@ThreadSafe
|
||||
final class InternalSubchannel implements WithLogId {
|
||||
final class InternalSubchannel implements InternalWithLogId {
|
||||
private static final Logger log = Logger.getLogger(InternalSubchannel.class.getName());
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final String authority;
|
||||
private final String userAgent;
|
||||
private final BackoffPolicy.Provider backoffPolicyProvider;
|
||||
|
|
@ -432,7 +434,7 @@ final class InternalSubchannel implements WithLogId {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import io.grpc.ConnectivityStateInfo;
|
|||
import io.grpc.Context;
|
||||
import io.grpc.DecompressorRegistry;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.LoadBalancer;
|
||||
import io.grpc.LoadBalancer.PickResult;
|
||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||
|
|
@ -74,7 +76,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
|||
|
||||
/** A communication channel for making outgoing RPCs. */
|
||||
@ThreadSafe
|
||||
public final class ManagedChannelImpl extends ManagedChannel implements WithLogId {
|
||||
public final class ManagedChannelImpl extends ManagedChannel implements InternalWithLogId {
|
||||
static final Logger logger = Logger.getLogger(ManagedChannelImpl.class.getName());
|
||||
|
||||
// Matching this pattern means the target string is a URI target or at least intended to be one.
|
||||
|
|
@ -108,7 +110,7 @@ public final class ManagedChannelImpl extends ManagedChannel implements WithLogI
|
|||
private final Executor executor;
|
||||
private final ObjectPool<? extends Executor> executorPool;
|
||||
private final ObjectPool<? extends Executor> oobExecutorPool;
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
|
||||
private final ChannelExecutor channelExecutor = new ChannelExecutor();
|
||||
|
||||
|
|
@ -869,7 +871,7 @@ public final class ManagedChannelImpl extends ManagedChannel implements WithLogI
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
@ -1026,7 +1028,7 @@ public final class ManagedChannelImpl extends ManagedChannel implements WithLogI
|
|||
Boolean.parseBoolean(System.getProperty(ALLOCATION_SITE_PROPERTY_NAME, "true"));
|
||||
private static final RuntimeException missingCallSite = missingCallSite();
|
||||
|
||||
private final LogId logId;
|
||||
private final InternalLogId logId;
|
||||
private final String target;
|
||||
private final Reference<RuntimeException> allocationSite;
|
||||
private volatile boolean shutdown;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package io.grpc.internal;
|
||||
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.Status;
|
||||
import javax.annotation.CheckReturnValue;
|
||||
import javax.annotation.Nullable;
|
||||
|
|
@ -33,7 +34,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
|||
* {@link Listener#transportTerminated}.
|
||||
*/
|
||||
@ThreadSafe
|
||||
public interface ManagedClientTransport extends ClientTransport, WithLogId {
|
||||
public interface ManagedClientTransport extends ClientTransport, InternalWithLogId {
|
||||
|
||||
/**
|
||||
* Starts transport. This method may only be called once.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import io.grpc.ClientCall;
|
|||
import io.grpc.ConnectivityStateInfo;
|
||||
import io.grpc.Context;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.LoadBalancer.Subchannel;
|
||||
import io.grpc.LoadBalancer;
|
||||
import io.grpc.LoadBalancer.PickResult;
|
||||
|
|
@ -48,14 +50,14 @@ import javax.annotation.concurrent.ThreadSafe;
|
|||
* to its own RPC needs.
|
||||
*/
|
||||
@ThreadSafe
|
||||
final class OobChannel extends ManagedChannel implements WithLogId {
|
||||
final class OobChannel extends ManagedChannel implements InternalWithLogId {
|
||||
private static final Logger log = Logger.getLogger(OobChannel.class.getName());
|
||||
|
||||
private InternalSubchannel subchannel;
|
||||
private AbstractSubchannel subchannelImpl;
|
||||
private SubchannelPicker subchannelPicker;
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final String authority;
|
||||
private final DelayedClientTransport delayedTransport;
|
||||
private final ObjectPool<? extends Executor> executorPool;
|
||||
|
|
@ -172,7 +174,7 @@ final class OobChannel extends ManagedChannel implements WithLogId {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ import io.grpc.Context;
|
|||
import io.grpc.Decompressor;
|
||||
import io.grpc.DecompressorRegistry;
|
||||
import io.grpc.HandlerRegistry;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalServerInterceptors;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.ServerCall;
|
||||
import io.grpc.ServerCallHandler;
|
||||
|
|
@ -70,11 +72,11 @@ import javax.annotation.concurrent.GuardedBy;
|
|||
* <p>Starting the server starts the underlying transport for servicing requests. Stopping the
|
||||
* server stops servicing new requests and waits for all connections to terminate.
|
||||
*/
|
||||
public final class ServerImpl extends io.grpc.Server implements WithLogId {
|
||||
public final class ServerImpl extends io.grpc.Server implements InternalWithLogId {
|
||||
private static final Logger log = Logger.getLogger(ServerImpl.class.getName());
|
||||
private static final ServerStreamListener NOOP_LISTENER = new NoopListener();
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final ObjectPool<? extends Executor> executorPool;
|
||||
/** Executor for application processing. Safe to read after {@link #start()}. */
|
||||
private Executor executor;
|
||||
|
|
@ -527,7 +529,7 @@ public final class ServerImpl extends io.grpc.Server implements WithLogId {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,13 @@
|
|||
package io.grpc.internal;
|
||||
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.Status;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/** An inbound connection. */
|
||||
public interface ServerTransport extends WithLogId {
|
||||
public interface ServerTransport extends InternalWithLogId {
|
||||
/**
|
||||
* Initiates an orderly shutdown of the transport. Existing streams continue, but new streams will
|
||||
* eventually begin failing. New streams "eventually" begin failing because shutdown may need to
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ import io.grpc.ConnectivityStateInfo;
|
|||
import io.grpc.Context;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
import io.grpc.IntegerMarshaller;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.LoadBalancer;
|
||||
import io.grpc.LoadBalancer.Helper;
|
||||
import io.grpc.LoadBalancer.PickResult;
|
||||
|
|
@ -1596,7 +1597,7 @@ public class ManagedChannelImplTest {
|
|||
false, // Don't create a transport, Helper maintains a ref to the channel.
|
||||
ManagedChannelImpl.IDLE_TIMEOUT_MILLIS_DISABLE);
|
||||
assertNotNull(channel);
|
||||
LogId logId = channel.getLogId();
|
||||
InternalLogId logId = channel.getLogId();
|
||||
|
||||
// Try to capture the log output but without causing terminal noise. Adding the filter must
|
||||
// be done before clearing the ref or else it might be missed.
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import io.grpc.Context;
|
|||
import io.grpc.Grpc;
|
||||
import io.grpc.HandlerRegistry;
|
||||
import io.grpc.IntegerMarshaller;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
|
|
@ -1264,7 +1265,7 @@ public class ServerImplTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import io.grpc.Attributes;
|
||||
import io.grpc.ConnectivityStateInfo;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.LoadBalancer;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.grpclb.GrpclbConstants.LbPolicy;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.internal.ObjectPool;
|
||||
import io.grpc.internal.WithLogId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
|
@ -42,10 +42,10 @@ import javax.annotation.Nullable;
|
|||
* <p>Optionally, when requested by the naming system, will delegate the work to a local pick-first
|
||||
* or round-robin balancer.
|
||||
*/
|
||||
class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
|
||||
class GrpclbLoadBalancer extends LoadBalancer implements InternalWithLogId {
|
||||
private static final Logger logger = Logger.getLogger(GrpclbLoadBalancer.class.getName());
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
|
||||
private final Helper helper;
|
||||
private final Factory pickFirstBalancerFactory;
|
||||
|
|
@ -81,7 +81,7 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import io.grpc.Attributes;
|
|||
import io.grpc.ConnectivityState;
|
||||
import io.grpc.ConnectivityStateInfo;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.LoadBalancer.Helper;
|
||||
import io.grpc.LoadBalancer.PickResult;
|
||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||
|
|
@ -42,7 +43,6 @@ import io.grpc.ManagedChannel;
|
|||
import io.grpc.Metadata;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.grpclb.LoadBalanceResponse.LoadBalanceResponseTypeCase;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
|
@ -53,8 +53,8 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -92,7 +92,7 @@ final class GrpclbState {
|
|||
}
|
||||
};
|
||||
|
||||
private final LogId logId;
|
||||
private final InternalLogId logId;
|
||||
private final String serviceName;
|
||||
private final Helper helper;
|
||||
private final TimeProvider time;
|
||||
|
|
@ -127,7 +127,10 @@ final class GrpclbState {
|
|||
new RoundRobinPicker(Collections.<DropEntry>emptyList(), Arrays.asList(BUFFER_ENTRY));
|
||||
|
||||
GrpclbState(
|
||||
Helper helper, TimeProvider time, ScheduledExecutorService timerService, LogId logId) {
|
||||
Helper helper,
|
||||
TimeProvider time,
|
||||
ScheduledExecutorService timerService,
|
||||
InternalLogId logId) {
|
||||
this.helper = checkNotNull(helper, "helper");
|
||||
this.time = checkNotNull(time, "time provider");
|
||||
this.timerService = checkNotNull(timerService, "timerService");
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.google.common.base.Preconditions;
|
|||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import io.grpc.Attributes;
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
|
|
@ -35,7 +36,6 @@ import io.grpc.internal.GrpcUtil;
|
|||
import io.grpc.internal.Http2Ping;
|
||||
import io.grpc.internal.KeepAliveManager;
|
||||
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.internal.StatsTraceContext;
|
||||
import io.grpc.internal.TransportTracer;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
|
|
@ -60,7 +60,7 @@ import javax.annotation.Nullable;
|
|||
* A Netty-based {@link ConnectionClientTransport} implementation.
|
||||
*/
|
||||
class NettyClientTransport implements ConnectionClientTransport {
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final Map<ChannelOption<?>, ?> channelOptions;
|
||||
private final SocketAddress address;
|
||||
private final Class<? extends Channel> channelType;
|
||||
|
|
@ -299,7 +299,7 @@ class NettyClientTransport implements ConnectionClientTransport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ import static io.grpc.netty.NettyServerBuilder.MAX_CONNECTION_AGE_NANOS_DISABLED
|
|||
import static io.netty.channel.ChannelOption.SO_BACKLOG;
|
||||
import static io.netty.channel.ChannelOption.SO_KEEPALIVE;
|
||||
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalWithLogId;
|
||||
import io.grpc.ServerStreamTracer;
|
||||
import io.grpc.internal.InternalServer;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.internal.ServerListener;
|
||||
import io.grpc.internal.ServerTransportListener;
|
||||
import io.grpc.internal.SharedResourceHolder;
|
||||
import io.grpc.internal.TransportTracer;
|
||||
import io.grpc.internal.WithLogId;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
|
|
@ -53,10 +53,10 @@ import javax.annotation.Nullable;
|
|||
/**
|
||||
* Netty-based server implementation.
|
||||
*/
|
||||
class NettyServer implements InternalServer, WithLogId {
|
||||
class NettyServer implements InternalServer, InternalWithLogId {
|
||||
private static final Logger log = Logger.getLogger(InternalServer.class.getName());
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final SocketAddress address;
|
||||
private final Class<? extends ServerChannel> channelType;
|
||||
private final Map<ChannelOption<?>, ?> channelOptions;
|
||||
|
|
@ -238,7 +238,7 @@ class NettyServer implements InternalServer, WithLogId {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.ServerStreamTracer;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.internal.ServerTransport;
|
||||
import io.grpc.internal.ServerTransportListener;
|
||||
import io.grpc.internal.TransportTracer;
|
||||
|
|
@ -53,7 +53,7 @@ class NettyServerTransport implements ServerTransport {
|
|||
"Connection reset by peer",
|
||||
"An existing connection was forcibly closed by the remote host");
|
||||
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
private final Channel channel;
|
||||
private final ProtocolNegotiator protocolNegotiator;
|
||||
private final int maxStreams;
|
||||
|
|
@ -139,7 +139,7 @@ class NettyServerTransport implements ServerTransport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.squareup.okhttp.Request;
|
|||
import com.squareup.okhttp.internal.http.StatusLine;
|
||||
import io.grpc.Attributes;
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.InternalLogId;
|
||||
import io.grpc.InternalTransportStats;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.MethodDescriptor;
|
||||
|
|
@ -42,7 +43,6 @@ import io.grpc.internal.GrpcUtil;
|
|||
import io.grpc.internal.Http2Ping;
|
||||
import io.grpc.internal.KeepAliveManager;
|
||||
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
||||
import io.grpc.internal.LogId;
|
||||
import io.grpc.internal.SerializingExecutor;
|
||||
import io.grpc.internal.SharedResourceHolder;
|
||||
import io.grpc.internal.StatsTraceContext;
|
||||
|
|
@ -133,7 +133,7 @@ class OkHttpClientTransport implements ConnectionClientTransport {
|
|||
private AsyncFrameWriter frameWriter;
|
||||
private OutboundFlowController outboundFlow;
|
||||
private final Object lock = new Object();
|
||||
private final LogId logId = LogId.allocate(getClass().getName());
|
||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
||||
@GuardedBy("lock")
|
||||
private int nextStreamId;
|
||||
@GuardedBy("lock")
|
||||
|
|
@ -568,7 +568,7 @@ class OkHttpClientTransport implements ConnectionClientTransport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LogId getLogId() {
|
||||
public InternalLogId getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue