mirror of https://github.com/grpc/grpc-java.git
all: add toString() to Server to improve debug info
This commit is contained in:
parent
0eafb8e9ca
commit
a6811d5bb1
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package io.grpc.alts;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.grpc.BindableService;
|
||||
import io.grpc.CompressorRegistry;
|
||||
import io.grpc.DecompressorRegistry;
|
||||
|
|
@ -248,5 +249,10 @@ public final class AltsServerBuilder extends ServerBuilder<AltsServerBuilder> {
|
|||
public void awaitTermination() throws InterruptedException {
|
||||
delegate.awaitTermination();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this).add("delegate", delegate).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package io.grpc.inprocess;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.grpc.ServerStreamTracer;
|
||||
import io.grpc.internal.Channelz.SocketStats;
|
||||
import io.grpc.internal.Instrumented;
|
||||
|
|
@ -95,6 +96,11 @@ final class InProcessServer implements InternalServer {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this).add("name", name).toString();
|
||||
}
|
||||
|
||||
synchronized ServerTransportListener register(InProcessTransport transport) {
|
||||
if (shutdown) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import static io.grpc.internal.GrpcUtil.TIMEOUT_KEY;
|
|||
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
|
|
@ -580,6 +581,14 @@ public final class ServerImpl extends io.grpc.Server implements Instrumented<Ser
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("logId", logId)
|
||||
.add("transportServer", transportServer)
|
||||
.toString();
|
||||
}
|
||||
|
||||
private static final class NoopListener implements ServerStreamListener {
|
||||
@Override
|
||||
public void messagesAvailable(MessageProducer producer) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ 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 com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
|
@ -304,6 +305,14 @@ class NettyServer implements InternalServer, WithLogId {
|
|||
return logId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("logId", logId)
|
||||
.add("address", address)
|
||||
.toString();
|
||||
}
|
||||
|
||||
class EventLoopReferenceCounter extends AbstractReferenceCounted {
|
||||
@Override
|
||||
protected void deallocate() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue