diff --git a/core/src/main/java/io/grpc/InternalInstrumented.java b/core/src/main/java/io/grpc/InternalInstrumented.java deleted file mode 100644 index d1d24d2227..0000000000 --- a/core/src/main/java/io/grpc/InternalInstrumented.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2017, gRPC Authors All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.grpc; - -/** - * This is an gRPC internal interface. Do not use this. - */ -@Internal -public interface InternalInstrumented extends Instrumented, InternalWithLogId { -} diff --git a/core/src/main/java/io/grpc/InternalLogId.java b/core/src/main/java/io/grpc/InternalLogId.java deleted file mode 100644 index d80f5fb21e..0000000000 --- a/core/src/main/java/io/grpc/InternalLogId.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016, gRPC Authors All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.grpc; - -/** - * Do not use this. This is an internal accessor class. - */ -@Internal -public final class InternalLogId extends LogId { - private InternalLogId(String tag, long id) { - super(tag, id); - } - - /** - * An accessor method for {@link LogId#allocate(String)}. - * - * @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 InternalLogId allocate(String tag) { - return new InternalLogId(tag, LogId.getNextId()); - } -} diff --git a/core/src/main/java/io/grpc/InternalWithLogId.java b/core/src/main/java/io/grpc/InternalWithLogId.java deleted file mode 100644 index 3bdb2cf193..0000000000 --- a/core/src/main/java/io/grpc/InternalWithLogId.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2016, gRPC Authors All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.grpc; - -/** - * Do not use this. - * - *

An object that has an ID that is unique within the JVM, primarily for debug logging. - */ -@Internal -public interface InternalWithLogId extends WithLogId { - @Override - InternalLogId getLogId(); -} diff --git a/core/src/main/java/io/grpc/inprocess/InProcessTransport.java b/core/src/main/java/io/grpc/inprocess/InProcessTransport.java index d6aa2143ab..96af341bc3 100644 --- a/core/src/main/java/io/grpc/inprocess/InProcessTransport.java +++ b/core/src/main/java/io/grpc/inprocess/InProcessTransport.java @@ -26,7 +26,6 @@ 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; @@ -36,6 +35,7 @@ import io.grpc.internal.ClientStream; import io.grpc.internal.ClientStreamListener; import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.GrpcUtil; +import io.grpc.internal.LogId; import io.grpc.internal.ManagedClientTransport; import io.grpc.internal.NoopClientStream; import io.grpc.internal.ObjectPool; @@ -64,7 +64,7 @@ import javax.annotation.concurrent.ThreadSafe; final class InProcessTransport implements ServerTransport, ConnectionClientTransport { private static final Logger log = Logger.getLogger(InProcessTransport.class.getName()); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final String name; private final String authority; private final String userAgent; @@ -210,7 +210,7 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/core/src/main/java/io/grpc/internal/AbstractSubchannel.java b/core/src/main/java/io/grpc/internal/AbstractSubchannel.java index cf79a62828..85f695aac7 100644 --- a/core/src/main/java/io/grpc/internal/AbstractSubchannel.java +++ b/core/src/main/java/io/grpc/internal/AbstractSubchannel.java @@ -17,8 +17,6 @@ package io.grpc.internal; import io.grpc.InternalChannelStats; -import io.grpc.InternalInstrumented; -import io.grpc.InternalLogId; import io.grpc.LoadBalancer; import javax.annotation.Nullable; @@ -27,8 +25,8 @@ import javax.annotation.Nullable; * io.grpc.LoadBalancer.Helper#createSubchannel}. */ abstract class AbstractSubchannel extends LoadBalancer.Subchannel - implements InternalInstrumented { - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + implements Instrumented { + private final LogId logId = LogId.allocate(getClass().getName()); /** * Same as {@link InternalSubchannel#obtainActiveTransport}. @@ -37,7 +35,7 @@ abstract class AbstractSubchannel extends LoadBalancer.Subchannel abstract ClientTransport obtainActiveTransport(); @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } } diff --git a/core/src/main/java/io/grpc/internal/ClientTransport.java b/core/src/main/java/io/grpc/internal/ClientTransport.java index 17b01907c8..07a3b3e693 100644 --- a/core/src/main/java/io/grpc/internal/ClientTransport.java +++ b/core/src/main/java/io/grpc/internal/ClientTransport.java @@ -17,7 +17,6 @@ package io.grpc.internal; import io.grpc.CallOptions; -import io.grpc.InternalInstrumented; import io.grpc.InternalTransportStats; import io.grpc.Metadata; import io.grpc.MethodDescriptor; @@ -31,7 +30,7 @@ import javax.annotation.concurrent.ThreadSafe; * are expected to execute quickly. */ @ThreadSafe -public interface ClientTransport extends InternalInstrumented { +public interface ClientTransport extends Instrumented { /** * Creates a new stream for sending messages to a remote end-point. diff --git a/core/src/main/java/io/grpc/internal/DelayedClientTransport.java b/core/src/main/java/io/grpc/internal/DelayedClientTransport.java index 620843e072..b4dc599c76 100644 --- a/core/src/main/java/io/grpc/internal/DelayedClientTransport.java +++ b/core/src/main/java/io/grpc/internal/DelayedClientTransport.java @@ -21,7 +21,6 @@ import com.google.common.util.concurrent.ListenableFuture; 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 +47,7 @@ import javax.annotation.concurrent.GuardedBy; * thus the delayed transport stops owning the stream. */ final class DelayedClientTransport implements ManagedClientTransport { - private final InternalLogId lodId = InternalLogId.allocate(getClass().getName()); + private final LogId lodId = LogId.allocate(getClass().getName()); private final Object lock = new Object(); @@ -338,7 +337,7 @@ final class DelayedClientTransport implements ManagedClientTransport { // TODO(carl-mastrangelo): remove this once the Subchannel change is in. @Override - public InternalLogId getLogId() { + public LogId getLogId() { return lodId; } diff --git a/core/src/main/java/io/grpc/internal/FailingClientTransport.java b/core/src/main/java/io/grpc/internal/FailingClientTransport.java index 2441a6f985..26ebd4c04b 100644 --- a/core/src/main/java/io/grpc/internal/FailingClientTransport.java +++ b/core/src/main/java/io/grpc/internal/FailingClientTransport.java @@ -21,7 +21,6 @@ import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import io.grpc.CallOptions; -import io.grpc.InternalLogId; import io.grpc.InternalTransportStats; import io.grpc.Metadata; import io.grpc.MethodDescriptor; @@ -63,7 +62,7 @@ class FailingClientTransport implements ClientTransport { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { throw new UnsupportedOperationException("Not a real transport"); } } diff --git a/core/src/main/java/io/grpc/internal/ForwardingConnectionClientTransport.java b/core/src/main/java/io/grpc/internal/ForwardingConnectionClientTransport.java index 1171b5717b..3d1fd7b66e 100644 --- a/core/src/main/java/io/grpc/internal/ForwardingConnectionClientTransport.java +++ b/core/src/main/java/io/grpc/internal/ForwardingConnectionClientTransport.java @@ -19,7 +19,6 @@ package io.grpc.internal; import com.google.common.util.concurrent.ListenableFuture; 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 +53,7 @@ abstract class ForwardingConnectionClientTransport implements ConnectionClientTr } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return delegate().getLogId(); } diff --git a/core/src/main/java/io/grpc/internal/GrpcUtil.java b/core/src/main/java/io/grpc/internal/GrpcUtil.java index 31be149840..32e2807f46 100644 --- a/core/src/main/java/io/grpc/internal/GrpcUtil.java +++ b/core/src/main/java/io/grpc/internal/GrpcUtil.java @@ -29,7 +29,6 @@ import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.ThreadFactoryBuilder; import io.grpc.CallOptions; import io.grpc.ClientStreamTracer; -import io.grpc.InternalLogId; import io.grpc.InternalMetadata; import io.grpc.InternalMetadata.TrustedAsciiMarshaller; import io.grpc.InternalTransportStats; @@ -684,7 +683,7 @@ public final class GrpcUtil { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return transport.getLogId(); } diff --git a/core/src/main/java/io/grpc/Instrumented.java b/core/src/main/java/io/grpc/internal/Instrumented.java similarity index 91% rename from core/src/main/java/io/grpc/Instrumented.java rename to core/src/main/java/io/grpc/internal/Instrumented.java index 529cfca433..70203a5b54 100644 --- a/core/src/main/java/io/grpc/Instrumented.java +++ b/core/src/main/java/io/grpc/internal/Instrumented.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.grpc; +package io.grpc.internal; import com.google.common.util.concurrent.ListenableFuture; @@ -22,6 +22,6 @@ import com.google.common.util.concurrent.ListenableFuture; * An interface for types that may support instrumentation. If the actual type does not * support instrumentation, then the future will return a {@code null}. */ -interface Instrumented extends WithLogId { +public interface Instrumented extends WithLogId { ListenableFuture getStats(); } diff --git a/core/src/main/java/io/grpc/internal/InternalSubchannel.java b/core/src/main/java/io/grpc/internal/InternalSubchannel.java index 959e887e52..6f402ca84d 100644 --- a/core/src/main/java/io/grpc/internal/InternalSubchannel.java +++ b/core/src/main/java/io/grpc/internal/InternalSubchannel.java @@ -30,8 +30,6 @@ 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; @@ -50,10 +48,10 @@ import javax.annotation.concurrent.ThreadSafe; * Transports for a single {@link SocketAddress}. */ @ThreadSafe -final class InternalSubchannel implements InternalWithLogId { +final class InternalSubchannel implements WithLogId { private static final Logger log = Logger.getLogger(InternalSubchannel.class.getName()); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final String authority; private final String userAgent; private final BackoffPolicy.Provider backoffPolicyProvider; @@ -434,7 +432,7 @@ final class InternalSubchannel implements InternalWithLogId { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/core/src/main/java/io/grpc/LogId.java b/core/src/main/java/io/grpc/internal/LogId.java similarity index 88% rename from core/src/main/java/io/grpc/LogId.java rename to core/src/main/java/io/grpc/internal/LogId.java index a7985f6b21..72c2e0e2f4 100644 --- a/core/src/main/java/io/grpc/LogId.java +++ b/core/src/main/java/io/grpc/internal/LogId.java @@ -14,15 +14,14 @@ * limitations under the License. */ -package io.grpc; +package io.grpc.internal; import java.util.concurrent.atomic.AtomicLong; /** - * A loggable ID, unique for the duration of the program. + * An object that has an ID that is unique within the JVM, primarily for debug logging. */ -// not final so that InternalLogId can make this class visible outside of io.grpc -class LogId { +public final class LogId { private static final AtomicLong idAlloc = new AtomicLong(); /** diff --git a/core/src/main/java/io/grpc/internal/ManagedChannelImpl.java b/core/src/main/java/io/grpc/internal/ManagedChannelImpl.java index 0a31567e12..8fa436e460 100644 --- a/core/src/main/java/io/grpc/internal/ManagedChannelImpl.java +++ b/core/src/main/java/io/grpc/internal/ManagedChannelImpl.java @@ -42,8 +42,6 @@ import io.grpc.Context; import io.grpc.DecompressorRegistry; import io.grpc.EquivalentAddressGroup; import io.grpc.InternalChannelStats; -import io.grpc.InternalInstrumented; -import io.grpc.InternalLogId; import io.grpc.LoadBalancer; import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickSubchannelArgs; @@ -84,7 +82,7 @@ import javax.annotation.concurrent.ThreadSafe; /** A communication channel for making outgoing RPCs. */ @ThreadSafe public final class ManagedChannelImpl - extends ManagedChannel implements InternalInstrumented { + extends ManagedChannel implements Instrumented { 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. @@ -110,7 +108,7 @@ public final class ManagedChannelImpl static final Status SUBCHANNEL_SHUTDOWN_STATUS = Status.UNAVAILABLE.withDescription("Subchannel shutdown invoked"); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final String target; private final NameResolver.Factory nameResolverFactory; private final Attributes nameResolverParams; @@ -288,7 +286,7 @@ public final class ManagedChannelImpl } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } @@ -1177,7 +1175,7 @@ public final class ManagedChannelImpl Boolean.parseBoolean(System.getProperty(ALLOCATION_SITE_PROPERTY_NAME, "true")); private static final RuntimeException missingCallSite = missingCallSite(); - private final InternalLogId logId; + private final LogId logId; private final String target; private final Reference allocationSite; private volatile boolean shutdown; diff --git a/core/src/main/java/io/grpc/internal/ManagedClientTransport.java b/core/src/main/java/io/grpc/internal/ManagedClientTransport.java index e50cd7902a..f9754fc333 100644 --- a/core/src/main/java/io/grpc/internal/ManagedClientTransport.java +++ b/core/src/main/java/io/grpc/internal/ManagedClientTransport.java @@ -16,7 +16,6 @@ package io.grpc.internal; -import io.grpc.InternalWithLogId; import io.grpc.Status; import javax.annotation.CheckReturnValue; import javax.annotation.Nullable; @@ -34,7 +33,7 @@ import javax.annotation.concurrent.ThreadSafe; * {@link Listener#transportTerminated}. */ @ThreadSafe -public interface ManagedClientTransport extends ClientTransport, InternalWithLogId { +public interface ManagedClientTransport extends ClientTransport { /** * Starts transport. This method may only be called once. diff --git a/core/src/main/java/io/grpc/internal/OobChannel.java b/core/src/main/java/io/grpc/internal/OobChannel.java index 466d16e6e8..d89491ce4e 100644 --- a/core/src/main/java/io/grpc/internal/OobChannel.java +++ b/core/src/main/java/io/grpc/internal/OobChannel.java @@ -28,8 +28,6 @@ import io.grpc.ConnectivityStateInfo; import io.grpc.Context; import io.grpc.EquivalentAddressGroup; import io.grpc.InternalChannelStats; -import io.grpc.InternalInstrumented; -import io.grpc.InternalLogId; import io.grpc.LoadBalancer; import io.grpc.LoadBalancer.PickResult; import io.grpc.LoadBalancer.PickSubchannelArgs; @@ -54,14 +52,14 @@ import javax.annotation.concurrent.ThreadSafe; */ @ThreadSafe final class OobChannel - extends ManagedChannel implements InternalInstrumented { + extends ManagedChannel implements Instrumented { private static final Logger log = Logger.getLogger(OobChannel.class.getName()); private InternalSubchannel subchannel; private AbstractSubchannel subchannelImpl; private SubchannelPicker subchannelPicker; - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final String authority; private final DelayedClientTransport delayedTransport; private final ObjectPool executorPool; @@ -266,7 +264,7 @@ final class OobChannel } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } } diff --git a/core/src/main/java/io/grpc/internal/ServerImpl.java b/core/src/main/java/io/grpc/internal/ServerImpl.java index df6d592387..c9932d293d 100644 --- a/core/src/main/java/io/grpc/internal/ServerImpl.java +++ b/core/src/main/java/io/grpc/internal/ServerImpl.java @@ -32,9 +32,7 @@ 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; @@ -72,11 +70,11 @@ import javax.annotation.concurrent.GuardedBy; *

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 InternalWithLogId { +public final class ServerImpl extends io.grpc.Server implements WithLogId { private static final Logger log = Logger.getLogger(ServerImpl.class.getName()); private static final ServerStreamListener NOOP_LISTENER = new NoopListener(); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final ObjectPool executorPool; /** Executor for application processing. Safe to read after {@link #start()}. */ private Executor executor; @@ -529,7 +527,7 @@ public final class ServerImpl extends io.grpc.Server implements InternalWithLogI } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/core/src/main/java/io/grpc/internal/ServerTransport.java b/core/src/main/java/io/grpc/internal/ServerTransport.java index ff4e6bb91b..1ea7bcf1ae 100644 --- a/core/src/main/java/io/grpc/internal/ServerTransport.java +++ b/core/src/main/java/io/grpc/internal/ServerTransport.java @@ -16,13 +16,12 @@ package io.grpc.internal; -import io.grpc.InternalInstrumented; import io.grpc.InternalTransportStats; import io.grpc.Status; import java.util.concurrent.ScheduledExecutorService; /** An inbound connection. */ -public interface ServerTransport extends InternalInstrumented { +public interface ServerTransport extends Instrumented { /** * 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 diff --git a/core/src/main/java/io/grpc/WithLogId.java b/core/src/main/java/io/grpc/internal/WithLogId.java similarity index 88% rename from core/src/main/java/io/grpc/WithLogId.java rename to core/src/main/java/io/grpc/internal/WithLogId.java index adf0cfedcf..46d66be236 100644 --- a/core/src/main/java/io/grpc/WithLogId.java +++ b/core/src/main/java/io/grpc/internal/WithLogId.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.grpc; +package io.grpc.internal; /** - * An object that has an ID that is unique within the JVM, primarily for debug logging. + * A loggable ID, unique for the duration of the program. */ -interface WithLogId { +public interface WithLogId { /** * 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. diff --git a/core/src/test/java/io/grpc/internal/ManagedChannelImplTest.java b/core/src/test/java/io/grpc/internal/ManagedChannelImplTest.java index 8e1a5bd069..fd04b1c6c9 100644 --- a/core/src/test/java/io/grpc/internal/ManagedChannelImplTest.java +++ b/core/src/test/java/io/grpc/internal/ManagedChannelImplTest.java @@ -61,8 +61,6 @@ import io.grpc.Context; import io.grpc.EquivalentAddressGroup; import io.grpc.IntegerMarshaller; import io.grpc.InternalChannelStats; -import io.grpc.InternalInstrumented; -import io.grpc.InternalLogId; import io.grpc.LoadBalancer; import io.grpc.LoadBalancer.Helper; import io.grpc.LoadBalancer.PickResult; @@ -1611,7 +1609,7 @@ public class ManagedChannelImplTest { false, // Don't create a transport, Helper maintains a ref to the channel. ManagedChannelImpl.IDLE_TIMEOUT_MILLIS_DISABLE); assertNotNull(channel); - InternalLogId logId = channel.getLogId(); + LogId 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. @@ -1987,7 +1985,7 @@ public class ManagedChannelImplTest { } private static InternalChannelStats getStats( - InternalInstrumented instrumented) throws Exception { + Instrumented instrumented) throws Exception { return instrumented.getStats().get(); } } diff --git a/core/src/test/java/io/grpc/internal/ServerImplTest.java b/core/src/test/java/io/grpc/internal/ServerImplTest.java index d5429c70ee..a7aabfac66 100644 --- a/core/src/test/java/io/grpc/internal/ServerImplTest.java +++ b/core/src/test/java/io/grpc/internal/ServerImplTest.java @@ -51,7 +51,6 @@ 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; @@ -1265,7 +1264,7 @@ public class ServerImplTest { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { throw new UnsupportedOperationException(); } diff --git a/cronet/src/main/java/io/grpc/cronet/CronetClientTransport.java b/cronet/src/main/java/io/grpc/cronet/CronetClientTransport.java index cabe6bef2d..d7d90388c8 100644 --- a/cronet/src/main/java/io/grpc/cronet/CronetClientTransport.java +++ b/cronet/src/main/java/io/grpc/cronet/CronetClientTransport.java @@ -26,13 +26,13 @@ import io.grpc.MethodDescriptor; import io.grpc.Status; import io.grpc.Status.Code; import io.grpc.cronet.CronetChannelBuilder.StreamBuilderFactory; -import io.grpc.InternalLogId; -import io.grpc.InternalWithLogId; import io.grpc.InternalTransportStats; import io.grpc.internal.ConnectionClientTransport; import io.grpc.internal.GrpcUtil; +import io.grpc.internal.LogId; import io.grpc.internal.StatsTraceContext; import io.grpc.internal.TransportTracer; +import io.grpc.internal.WithLogId; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.HashSet; @@ -44,8 +44,8 @@ import javax.annotation.concurrent.GuardedBy; /** * A cronet-based {@link ConnectionClientTransport} implementation. */ -class CronetClientTransport implements ConnectionClientTransport, InternalWithLogId { - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); +class CronetClientTransport implements ConnectionClientTransport { + private final LogId logId = LogId.allocate(getClass().getName()); private final InetSocketAddress address; private final String authority; private final String userAgent; @@ -226,7 +226,7 @@ class CronetClientTransport implements ConnectionClientTransport, InternalWithLo } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/grpclb/src/main/java/io/grpc/grpclb/GrpclbLoadBalancer.java b/grpclb/src/main/java/io/grpc/grpclb/GrpclbLoadBalancer.java index adc280bb5d..17e3a50301 100644 --- a/grpclb/src/main/java/io/grpc/grpclb/GrpclbLoadBalancer.java +++ b/grpclb/src/main/java/io/grpc/grpclb/GrpclbLoadBalancer.java @@ -22,13 +22,13 @@ 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.GrpcAttributes; +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; @@ -43,10 +43,10 @@ import javax.annotation.Nullable; *

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 InternalWithLogId { +class GrpclbLoadBalancer extends LoadBalancer implements WithLogId { private static final Logger logger = Logger.getLogger(GrpclbLoadBalancer.class.getName()); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final Helper helper; private final Factory pickFirstBalancerFactory; @@ -82,7 +82,7 @@ class GrpclbLoadBalancer extends LoadBalancer implements InternalWithLogId { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java b/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java index 34c96abf95..b35988f7f7 100644 --- a/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java +++ b/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java @@ -33,7 +33,6 @@ 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; @@ -43,6 +42,7 @@ 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; @@ -92,7 +92,7 @@ final class GrpclbState { } }; - private final InternalLogId logId; + private final LogId logId; private final String serviceName; private final Helper helper; private final TimeProvider time; @@ -130,7 +130,7 @@ final class GrpclbState { Helper helper, TimeProvider time, ScheduledExecutorService timerService, - InternalLogId logId) { + LogId logId) { this.helper = checkNotNull(helper, "helper"); this.time = checkNotNull(time, "time provider"); this.timerService = checkNotNull(timerService, "timerService"); diff --git a/netty/src/main/java/io/grpc/netty/NettyClientTransport.java b/netty/src/main/java/io/grpc/netty/NettyClientTransport.java index d595de6972..7cea3da53c 100644 --- a/netty/src/main/java/io/grpc/netty/NettyClientTransport.java +++ b/netty/src/main/java/io/grpc/netty/NettyClientTransport.java @@ -25,7 +25,6 @@ import com.google.common.util.concurrent.ListenableFuture; 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; @@ -37,6 +36,7 @@ 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; @@ -61,7 +61,7 @@ import javax.annotation.Nullable; */ class NettyClientTransport implements ConnectionClientTransport { private static final Logger log = Logger.getLogger(NettyServerTransport.class.getName()); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final Map, ?> channelOptions; private final SocketAddress address; private final Class channelType; @@ -300,7 +300,7 @@ class NettyClientTransport implements ConnectionClientTransport { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/netty/src/main/java/io/grpc/netty/NettyServer.java b/netty/src/main/java/io/grpc/netty/NettyServer.java index bd435c5f97..81c09cb984 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServer.java +++ b/netty/src/main/java/io/grpc/netty/NettyServer.java @@ -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; @@ -54,10 +54,10 @@ import javax.annotation.Nullable; /** * Netty-based server implementation. */ -class NettyServer implements InternalServer, InternalWithLogId { +class NettyServer implements InternalServer, WithLogId { private static final Logger log = Logger.getLogger(InternalServer.class.getName()); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final SocketAddress address; private final Class channelType; private final Map, ?> channelOptions; @@ -263,7 +263,7 @@ class NettyServer implements InternalServer, InternalWithLogId { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/netty/src/main/java/io/grpc/netty/NettyServerTransport.java b/netty/src/main/java/io/grpc/netty/NettyServerTransport.java index f02f3fed8a..cf550f8f9b 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServerTransport.java +++ b/netty/src/main/java/io/grpc/netty/NettyServerTransport.java @@ -21,10 +21,10 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.ListenableFuture; 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; @@ -52,7 +52,7 @@ class NettyServerTransport implements ServerTransport { "Connection reset by peer", "An existing connection was forcibly closed by the remote host"); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); private final Channel channel; private final ChannelPromise channelUnused; private final ProtocolNegotiator protocolNegotiator; @@ -157,7 +157,7 @@ class NettyServerTransport implements ServerTransport { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; } diff --git a/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java b/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java index df20daeae9..8f03cddceb 100644 --- a/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java +++ b/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java @@ -31,7 +31,6 @@ 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; @@ -44,6 +43,7 @@ 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; @@ -134,7 +134,7 @@ class OkHttpClientTransport implements ConnectionClientTransport { private AsyncFrameWriter frameWriter; private OutboundFlowController outboundFlow; private final Object lock = new Object(); - private final InternalLogId logId = InternalLogId.allocate(getClass().getName()); + private final LogId logId = LogId.allocate(getClass().getName()); @GuardedBy("lock") private int nextStreamId; @GuardedBy("lock") @@ -604,7 +604,7 @@ class OkHttpClientTransport implements ConnectionClientTransport { } @Override - public InternalLogId getLogId() { + public LogId getLogId() { return logId; }