mirror of https://github.com/grpc/grpc-java.git
core: move Instrumented, LogId, WithLogId to io.grpc.internal as public (#3995)
This commit is contained in:
parent
2a93e6b92f
commit
b109595ad3
|
|
@ -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<T> extends Instrumented<T>, InternalWithLogId {
|
|
||||||
}
|
|
||||||
|
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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.
|
|
||||||
*
|
|
||||||
* <p>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();
|
|
||||||
}
|
|
||||||
|
|
@ -26,7 +26,6 @@ import io.grpc.Compressor;
|
||||||
import io.grpc.Decompressor;
|
import io.grpc.Decompressor;
|
||||||
import io.grpc.DecompressorRegistry;
|
import io.grpc.DecompressorRegistry;
|
||||||
import io.grpc.Grpc;
|
import io.grpc.Grpc;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -36,6 +35,7 @@ import io.grpc.internal.ClientStream;
|
||||||
import io.grpc.internal.ClientStreamListener;
|
import io.grpc.internal.ClientStreamListener;
|
||||||
import io.grpc.internal.ConnectionClientTransport;
|
import io.grpc.internal.ConnectionClientTransport;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.ManagedClientTransport;
|
import io.grpc.internal.ManagedClientTransport;
|
||||||
import io.grpc.internal.NoopClientStream;
|
import io.grpc.internal.NoopClientStream;
|
||||||
import io.grpc.internal.ObjectPool;
|
import io.grpc.internal.ObjectPool;
|
||||||
|
|
@ -64,7 +64,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
final class InProcessTransport implements ServerTransport, ConnectionClientTransport {
|
final class InProcessTransport implements ServerTransport, ConnectionClientTransport {
|
||||||
private static final Logger log = Logger.getLogger(InProcessTransport.class.getName());
|
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 name;
|
||||||
private final String authority;
|
private final String authority;
|
||||||
private final String userAgent;
|
private final String userAgent;
|
||||||
|
|
@ -210,7 +210,7 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
package io.grpc.internal;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import io.grpc.InternalChannelStats;
|
import io.grpc.InternalChannelStats;
|
||||||
import io.grpc.InternalInstrumented;
|
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
@ -27,8 +25,8 @@ import javax.annotation.Nullable;
|
||||||
* io.grpc.LoadBalancer.Helper#createSubchannel}.
|
* io.grpc.LoadBalancer.Helper#createSubchannel}.
|
||||||
*/
|
*/
|
||||||
abstract class AbstractSubchannel extends LoadBalancer.Subchannel
|
abstract class AbstractSubchannel extends LoadBalancer.Subchannel
|
||||||
implements InternalInstrumented<InternalChannelStats> {
|
implements Instrumented<InternalChannelStats> {
|
||||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
private final LogId logId = LogId.allocate(getClass().getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link InternalSubchannel#obtainActiveTransport}.
|
* Same as {@link InternalSubchannel#obtainActiveTransport}.
|
||||||
|
|
@ -37,7 +35,7 @@ abstract class AbstractSubchannel extends LoadBalancer.Subchannel
|
||||||
abstract ClientTransport obtainActiveTransport();
|
abstract ClientTransport obtainActiveTransport();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package io.grpc.internal;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.InternalInstrumented;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -31,7 +30,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
* are expected to execute quickly.
|
* are expected to execute quickly.
|
||||||
*/
|
*/
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
public interface ClientTransport extends InternalInstrumented<InternalTransportStats> {
|
public interface ClientTransport extends Instrumented<InternalTransportStats> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new stream for sending messages to a remote end-point.
|
* Creates a new stream for sending messages to a remote end-point.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.Context;
|
import io.grpc.Context;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.LoadBalancer.PickResult;
|
import io.grpc.LoadBalancer.PickResult;
|
||||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||||
|
|
@ -48,7 +47,7 @@ import javax.annotation.concurrent.GuardedBy;
|
||||||
* thus the delayed transport stops owning the stream.
|
* thus the delayed transport stops owning the stream.
|
||||||
*/
|
*/
|
||||||
final class DelayedClientTransport implements ManagedClientTransport {
|
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();
|
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.
|
// TODO(carl-mastrangelo): remove this once the Subchannel change is in.
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return lodId;
|
return lodId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import com.google.common.base.Preconditions;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -63,7 +62,7 @@ class FailingClientTransport implements ClientTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
throw new UnsupportedOperationException("Not a real transport");
|
throw new UnsupportedOperationException("Not a real transport");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.grpc.internal;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -54,7 +53,7 @@ abstract class ForwardingConnectionClientTransport implements ConnectionClientTr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return delegate().getLogId();
|
return delegate().getLogId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import com.google.common.util.concurrent.MoreExecutors;
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.ClientStreamTracer;
|
import io.grpc.ClientStreamTracer;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalMetadata;
|
import io.grpc.InternalMetadata;
|
||||||
import io.grpc.InternalMetadata.TrustedAsciiMarshaller;
|
import io.grpc.InternalMetadata.TrustedAsciiMarshaller;
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
|
|
@ -684,7 +683,7 @@ public final class GrpcUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return transport.getLogId();
|
return transport.getLogId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.grpc;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
|
@ -22,6 +22,6 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* An interface for types that <b>may</b> support instrumentation. If the actual type does not
|
* An interface for types that <b>may</b> support instrumentation. If the actual type does not
|
||||||
* support instrumentation, then the future will return a {@code null}.
|
* support instrumentation, then the future will return a {@code null}.
|
||||||
*/
|
*/
|
||||||
interface Instrumented<T> extends WithLogId {
|
public interface Instrumented<T> extends WithLogId {
|
||||||
ListenableFuture<T> getStats();
|
ListenableFuture<T> getStats();
|
||||||
}
|
}
|
||||||
|
|
@ -30,8 +30,6 @@ import com.google.errorprone.annotations.ForOverride;
|
||||||
import io.grpc.ConnectivityState;
|
import io.grpc.ConnectivityState;
|
||||||
import io.grpc.ConnectivityStateInfo;
|
import io.grpc.ConnectivityStateInfo;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalWithLogId;
|
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -50,10 +48,10 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
* Transports for a single {@link SocketAddress}.
|
* Transports for a single {@link SocketAddress}.
|
||||||
*/
|
*/
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
final class InternalSubchannel implements InternalWithLogId {
|
final class InternalSubchannel implements WithLogId {
|
||||||
private static final Logger log = Logger.getLogger(InternalSubchannel.class.getName());
|
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 authority;
|
||||||
private final String userAgent;
|
private final String userAgent;
|
||||||
private final BackoffPolicy.Provider backoffPolicyProvider;
|
private final BackoffPolicy.Provider backoffPolicyProvider;
|
||||||
|
|
@ -434,7 +432,7 @@ final class InternalSubchannel implements InternalWithLogId {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,14 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.grpc;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
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
|
public final class LogId {
|
||||||
class LogId {
|
|
||||||
private static final AtomicLong idAlloc = new AtomicLong();
|
private static final AtomicLong idAlloc = new AtomicLong();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -42,8 +42,6 @@ import io.grpc.Context;
|
||||||
import io.grpc.DecompressorRegistry;
|
import io.grpc.DecompressorRegistry;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.InternalChannelStats;
|
import io.grpc.InternalChannelStats;
|
||||||
import io.grpc.InternalInstrumented;
|
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import io.grpc.LoadBalancer.PickResult;
|
import io.grpc.LoadBalancer.PickResult;
|
||||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||||
|
|
@ -84,7 +82,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
/** A communication channel for making outgoing RPCs. */
|
/** A communication channel for making outgoing RPCs. */
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
public final class ManagedChannelImpl
|
public final class ManagedChannelImpl
|
||||||
extends ManagedChannel implements InternalInstrumented<InternalChannelStats> {
|
extends ManagedChannel implements Instrumented<InternalChannelStats> {
|
||||||
static final Logger logger = Logger.getLogger(ManagedChannelImpl.class.getName());
|
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.
|
// 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 =
|
static final Status SUBCHANNEL_SHUTDOWN_STATUS =
|
||||||
Status.UNAVAILABLE.withDescription("Subchannel shutdown invoked");
|
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 String target;
|
||||||
private final NameResolver.Factory nameResolverFactory;
|
private final NameResolver.Factory nameResolverFactory;
|
||||||
private final Attributes nameResolverParams;
|
private final Attributes nameResolverParams;
|
||||||
|
|
@ -288,7 +286,7 @@ public final class ManagedChannelImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1177,7 +1175,7 @@ public final class ManagedChannelImpl
|
||||||
Boolean.parseBoolean(System.getProperty(ALLOCATION_SITE_PROPERTY_NAME, "true"));
|
Boolean.parseBoolean(System.getProperty(ALLOCATION_SITE_PROPERTY_NAME, "true"));
|
||||||
private static final RuntimeException missingCallSite = missingCallSite();
|
private static final RuntimeException missingCallSite = missingCallSite();
|
||||||
|
|
||||||
private final InternalLogId logId;
|
private final LogId logId;
|
||||||
private final String target;
|
private final String target;
|
||||||
private final Reference<RuntimeException> allocationSite;
|
private final Reference<RuntimeException> allocationSite;
|
||||||
private volatile boolean shutdown;
|
private volatile boolean shutdown;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package io.grpc.internal;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import io.grpc.InternalWithLogId;
|
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import javax.annotation.CheckReturnValue;
|
import javax.annotation.CheckReturnValue;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
@ -34,7 +33,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
* {@link Listener#transportTerminated}.
|
* {@link Listener#transportTerminated}.
|
||||||
*/
|
*/
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
public interface ManagedClientTransport extends ClientTransport, InternalWithLogId {
|
public interface ManagedClientTransport extends ClientTransport {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts transport. This method may only be called once.
|
* Starts transport. This method may only be called once.
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ import io.grpc.ConnectivityStateInfo;
|
||||||
import io.grpc.Context;
|
import io.grpc.Context;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.InternalChannelStats;
|
import io.grpc.InternalChannelStats;
|
||||||
import io.grpc.InternalInstrumented;
|
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import io.grpc.LoadBalancer.PickResult;
|
import io.grpc.LoadBalancer.PickResult;
|
||||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||||
|
|
@ -54,14 +52,14 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
*/
|
*/
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
final class OobChannel
|
final class OobChannel
|
||||||
extends ManagedChannel implements InternalInstrumented<InternalChannelStats> {
|
extends ManagedChannel implements Instrumented<InternalChannelStats> {
|
||||||
private static final Logger log = Logger.getLogger(OobChannel.class.getName());
|
private static final Logger log = Logger.getLogger(OobChannel.class.getName());
|
||||||
|
|
||||||
private InternalSubchannel subchannel;
|
private InternalSubchannel subchannel;
|
||||||
private AbstractSubchannel subchannelImpl;
|
private AbstractSubchannel subchannelImpl;
|
||||||
private SubchannelPicker subchannelPicker;
|
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 String authority;
|
||||||
private final DelayedClientTransport delayedTransport;
|
private final DelayedClientTransport delayedTransport;
|
||||||
private final ObjectPool<? extends Executor> executorPool;
|
private final ObjectPool<? extends Executor> executorPool;
|
||||||
|
|
@ -266,7 +264,7 @@ final class OobChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,7 @@ import io.grpc.Context;
|
||||||
import io.grpc.Decompressor;
|
import io.grpc.Decompressor;
|
||||||
import io.grpc.DecompressorRegistry;
|
import io.grpc.DecompressorRegistry;
|
||||||
import io.grpc.HandlerRegistry;
|
import io.grpc.HandlerRegistry;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalServerInterceptors;
|
import io.grpc.InternalServerInterceptors;
|
||||||
import io.grpc.InternalWithLogId;
|
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.ServerCall;
|
import io.grpc.ServerCall;
|
||||||
import io.grpc.ServerCallHandler;
|
import io.grpc.ServerCallHandler;
|
||||||
|
|
@ -72,11 +70,11 @@ import javax.annotation.concurrent.GuardedBy;
|
||||||
* <p>Starting the server starts the underlying transport for servicing requests. Stopping the
|
* <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.
|
* 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 Logger log = Logger.getLogger(ServerImpl.class.getName());
|
||||||
private static final ServerStreamListener NOOP_LISTENER = new NoopListener();
|
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<? extends Executor> executorPool;
|
private final ObjectPool<? extends Executor> executorPool;
|
||||||
/** Executor for application processing. Safe to read after {@link #start()}. */
|
/** Executor for application processing. Safe to read after {@link #start()}. */
|
||||||
private Executor executor;
|
private Executor executor;
|
||||||
|
|
@ -529,7 +527,7 @@ public final class ServerImpl extends io.grpc.Server implements InternalWithLogI
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,12 @@
|
||||||
|
|
||||||
package io.grpc.internal;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import io.grpc.InternalInstrumented;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
/** An inbound connection. */
|
/** An inbound connection. */
|
||||||
public interface ServerTransport extends InternalInstrumented<InternalTransportStats> {
|
public interface ServerTransport extends Instrumented<InternalTransportStats> {
|
||||||
/**
|
/**
|
||||||
* Initiates an orderly shutdown of the transport. Existing streams continue, but new streams will
|
* 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
|
* eventually begin failing. New streams "eventually" begin failing because shutdown may need to
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* 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
|
* 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.
|
* numeric ID that is unique among the instances.
|
||||||
|
|
@ -61,8 +61,6 @@ import io.grpc.Context;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.IntegerMarshaller;
|
import io.grpc.IntegerMarshaller;
|
||||||
import io.grpc.InternalChannelStats;
|
import io.grpc.InternalChannelStats;
|
||||||
import io.grpc.InternalInstrumented;
|
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import io.grpc.LoadBalancer.Helper;
|
import io.grpc.LoadBalancer.Helper;
|
||||||
import io.grpc.LoadBalancer.PickResult;
|
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.
|
false, // Don't create a transport, Helper maintains a ref to the channel.
|
||||||
ManagedChannelImpl.IDLE_TIMEOUT_MILLIS_DISABLE);
|
ManagedChannelImpl.IDLE_TIMEOUT_MILLIS_DISABLE);
|
||||||
assertNotNull(channel);
|
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
|
// 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.
|
// be done before clearing the ref or else it might be missed.
|
||||||
|
|
@ -1987,7 +1985,7 @@ public class ManagedChannelImplTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InternalChannelStats getStats(
|
private static InternalChannelStats getStats(
|
||||||
InternalInstrumented<InternalChannelStats> instrumented) throws Exception {
|
Instrumented<InternalChannelStats> instrumented) throws Exception {
|
||||||
return instrumented.getStats().get();
|
return instrumented.getStats().get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ import io.grpc.Context;
|
||||||
import io.grpc.Grpc;
|
import io.grpc.Grpc;
|
||||||
import io.grpc.HandlerRegistry;
|
import io.grpc.HandlerRegistry;
|
||||||
import io.grpc.IntegerMarshaller;
|
import io.grpc.IntegerMarshaller;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -1265,7 +1264,7 @@ public class ServerImplTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ import io.grpc.MethodDescriptor;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.Status.Code;
|
import io.grpc.Status.Code;
|
||||||
import io.grpc.cronet.CronetChannelBuilder.StreamBuilderFactory;
|
import io.grpc.cronet.CronetChannelBuilder.StreamBuilderFactory;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalWithLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.internal.ConnectionClientTransport;
|
import io.grpc.internal.ConnectionClientTransport;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.StatsTraceContext;
|
import io.grpc.internal.StatsTraceContext;
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
|
import io.grpc.internal.WithLogId;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
@ -44,8 +44,8 @@ import javax.annotation.concurrent.GuardedBy;
|
||||||
/**
|
/**
|
||||||
* A cronet-based {@link ConnectionClientTransport} implementation.
|
* A cronet-based {@link ConnectionClientTransport} implementation.
|
||||||
*/
|
*/
|
||||||
class CronetClientTransport implements ConnectionClientTransport, InternalWithLogId {
|
class CronetClientTransport implements ConnectionClientTransport {
|
||||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
private final LogId logId = LogId.allocate(getClass().getName());
|
||||||
private final InetSocketAddress address;
|
private final InetSocketAddress address;
|
||||||
private final String authority;
|
private final String authority;
|
||||||
private final String userAgent;
|
private final String userAgent;
|
||||||
|
|
@ -226,7 +226,7 @@ class CronetClientTransport implements ConnectionClientTransport, InternalWithLo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.ConnectivityStateInfo;
|
import io.grpc.ConnectivityStateInfo;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalWithLogId;
|
|
||||||
import io.grpc.LoadBalancer;
|
import io.grpc.LoadBalancer;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.grpclb.GrpclbConstants.LbPolicy;
|
import io.grpc.grpclb.GrpclbConstants.LbPolicy;
|
||||||
import io.grpc.internal.GrpcAttributes;
|
import io.grpc.internal.GrpcAttributes;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.ObjectPool;
|
import io.grpc.internal.ObjectPool;
|
||||||
|
import io.grpc.internal.WithLogId;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -43,10 +43,10 @@ import javax.annotation.Nullable;
|
||||||
* <p>Optionally, when requested by the naming system, will delegate the work to a local pick-first
|
* <p>Optionally, when requested by the naming system, will delegate the work to a local pick-first
|
||||||
* or round-robin balancer.
|
* 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 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 Helper helper;
|
||||||
private final Factory pickFirstBalancerFactory;
|
private final Factory pickFirstBalancerFactory;
|
||||||
|
|
@ -82,7 +82,7 @@ class GrpclbLoadBalancer extends LoadBalancer implements InternalWithLogId {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import io.grpc.Attributes;
|
||||||
import io.grpc.ConnectivityState;
|
import io.grpc.ConnectivityState;
|
||||||
import io.grpc.ConnectivityStateInfo;
|
import io.grpc.ConnectivityStateInfo;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.LoadBalancer.Helper;
|
import io.grpc.LoadBalancer.Helper;
|
||||||
import io.grpc.LoadBalancer.PickResult;
|
import io.grpc.LoadBalancer.PickResult;
|
||||||
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
import io.grpc.LoadBalancer.PickSubchannelArgs;
|
||||||
|
|
@ -43,6 +42,7 @@ import io.grpc.ManagedChannel;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.grpclb.LoadBalanceResponse.LoadBalanceResponseTypeCase;
|
import io.grpc.grpclb.LoadBalanceResponse.LoadBalanceResponseTypeCase;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.stub.StreamObserver;
|
import io.grpc.stub.StreamObserver;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
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 String serviceName;
|
||||||
private final Helper helper;
|
private final Helper helper;
|
||||||
private final TimeProvider time;
|
private final TimeProvider time;
|
||||||
|
|
@ -130,7 +130,7 @@ final class GrpclbState {
|
||||||
Helper helper,
|
Helper helper,
|
||||||
TimeProvider time,
|
TimeProvider time,
|
||||||
ScheduledExecutorService timerService,
|
ScheduledExecutorService timerService,
|
||||||
InternalLogId logId) {
|
LogId logId) {
|
||||||
this.helper = checkNotNull(helper, "helper");
|
this.helper = checkNotNull(helper, "helper");
|
||||||
this.time = checkNotNull(time, "time provider");
|
this.time = checkNotNull(time, "time provider");
|
||||||
this.timerService = checkNotNull(timerService, "timerService");
|
this.timerService = checkNotNull(timerService, "timerService");
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -37,6 +36,7 @@ import io.grpc.internal.GrpcUtil;
|
||||||
import io.grpc.internal.Http2Ping;
|
import io.grpc.internal.Http2Ping;
|
||||||
import io.grpc.internal.KeepAliveManager;
|
import io.grpc.internal.KeepAliveManager;
|
||||||
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.StatsTraceContext;
|
import io.grpc.internal.StatsTraceContext;
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
|
|
@ -61,7 +61,7 @@ import javax.annotation.Nullable;
|
||||||
*/
|
*/
|
||||||
class NettyClientTransport implements ConnectionClientTransport {
|
class NettyClientTransport implements ConnectionClientTransport {
|
||||||
private static final Logger log = Logger.getLogger(NettyServerTransport.class.getName());
|
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<ChannelOption<?>, ?> channelOptions;
|
private final Map<ChannelOption<?>, ?> channelOptions;
|
||||||
private final SocketAddress address;
|
private final SocketAddress address;
|
||||||
private final Class<? extends Channel> channelType;
|
private final Class<? extends Channel> channelType;
|
||||||
|
|
@ -300,7 +300,7 @@ class NettyClientTransport implements ConnectionClientTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
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_BACKLOG;
|
||||||
import static io.netty.channel.ChannelOption.SO_KEEPALIVE;
|
import static io.netty.channel.ChannelOption.SO_KEEPALIVE;
|
||||||
|
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalWithLogId;
|
|
||||||
import io.grpc.ServerStreamTracer;
|
import io.grpc.ServerStreamTracer;
|
||||||
import io.grpc.internal.InternalServer;
|
import io.grpc.internal.InternalServer;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.ServerListener;
|
import io.grpc.internal.ServerListener;
|
||||||
import io.grpc.internal.ServerTransportListener;
|
import io.grpc.internal.ServerTransportListener;
|
||||||
import io.grpc.internal.SharedResourceHolder;
|
import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
|
import io.grpc.internal.WithLogId;
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
|
|
@ -54,10 +54,10 @@ import javax.annotation.Nullable;
|
||||||
/**
|
/**
|
||||||
* Netty-based server implementation.
|
* 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 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 SocketAddress address;
|
||||||
private final Class<? extends ServerChannel> channelType;
|
private final Class<? extends ServerChannel> channelType;
|
||||||
private final Map<ChannelOption<?>, ?> channelOptions;
|
private final Map<ChannelOption<?>, ?> channelOptions;
|
||||||
|
|
@ -263,7 +263,7 @@ class NettyServer implements InternalServer, InternalWithLogId {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.ServerStreamTracer;
|
import io.grpc.ServerStreamTracer;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.ServerTransport;
|
import io.grpc.internal.ServerTransport;
|
||||||
import io.grpc.internal.ServerTransportListener;
|
import io.grpc.internal.ServerTransportListener;
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
|
|
@ -52,7 +52,7 @@ class NettyServerTransport implements ServerTransport {
|
||||||
"Connection reset by peer",
|
"Connection reset by peer",
|
||||||
"An existing connection was forcibly closed by the remote host");
|
"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 Channel channel;
|
||||||
private final ChannelPromise channelUnused;
|
private final ChannelPromise channelUnused;
|
||||||
private final ProtocolNegotiator protocolNegotiator;
|
private final ProtocolNegotiator protocolNegotiator;
|
||||||
|
|
@ -157,7 +157,7 @@ class NettyServerTransport implements ServerTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import com.squareup.okhttp.Request;
|
||||||
import com.squareup.okhttp.internal.http.StatusLine;
|
import com.squareup.okhttp.internal.http.StatusLine;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.CallOptions;
|
import io.grpc.CallOptions;
|
||||||
import io.grpc.InternalLogId;
|
|
||||||
import io.grpc.InternalTransportStats;
|
import io.grpc.InternalTransportStats;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
|
@ -44,6 +43,7 @@ import io.grpc.internal.GrpcUtil;
|
||||||
import io.grpc.internal.Http2Ping;
|
import io.grpc.internal.Http2Ping;
|
||||||
import io.grpc.internal.KeepAliveManager;
|
import io.grpc.internal.KeepAliveManager;
|
||||||
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
||||||
|
import io.grpc.internal.LogId;
|
||||||
import io.grpc.internal.SerializingExecutor;
|
import io.grpc.internal.SerializingExecutor;
|
||||||
import io.grpc.internal.SharedResourceHolder;
|
import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.internal.StatsTraceContext;
|
import io.grpc.internal.StatsTraceContext;
|
||||||
|
|
@ -134,7 +134,7 @@ class OkHttpClientTransport implements ConnectionClientTransport {
|
||||||
private AsyncFrameWriter frameWriter;
|
private AsyncFrameWriter frameWriter;
|
||||||
private OutboundFlowController outboundFlow;
|
private OutboundFlowController outboundFlow;
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
private final InternalLogId logId = InternalLogId.allocate(getClass().getName());
|
private final LogId logId = LogId.allocate(getClass().getName());
|
||||||
@GuardedBy("lock")
|
@GuardedBy("lock")
|
||||||
private int nextStreamId;
|
private int nextStreamId;
|
||||||
@GuardedBy("lock")
|
@GuardedBy("lock")
|
||||||
|
|
@ -604,7 +604,7 @@ class OkHttpClientTransport implements ConnectionClientTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalLogId getLogId() {
|
public LogId getLogId() {
|
||||||
return logId;
|
return logId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue