mirror of https://github.com/grpc/grpc-java.git
services: turn channelz null futures into Status.UNIMPLEMENTED (#4346)
Then channelz GUI will take this into account. This is particularly useful for InProcessTransport, where I have decided we do not need special support for in channelz. The server and channel stats are already sufficient.
This commit is contained in:
parent
791a29f63b
commit
c04278ea07
|
|
@ -226,7 +226,6 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<SocketStats> getStats() {
|
public ListenableFuture<SocketStats> getStats() {
|
||||||
// TODO(zpencer): add transport tracing to in-process server
|
|
||||||
SettableFuture<SocketStats> ret = SettableFuture.create();
|
SettableFuture<SocketStats> ret = SettableFuture.create();
|
||||||
ret.set(null);
|
ret.set(null);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,14 @@ final class ChannelzProtoUtil {
|
||||||
|
|
||||||
private static <T> T getFuture(ListenableFuture<T> future) {
|
private static <T> T getFuture(ListenableFuture<T> future) {
|
||||||
try {
|
try {
|
||||||
return future.get();
|
T ret = future.get();
|
||||||
|
if (ret == null) {
|
||||||
|
throw Status.UNIMPLEMENTED
|
||||||
|
.withDescription("The entity's stats can not be retrieved. "
|
||||||
|
+ "If this is an InProcessTransport this is expected.")
|
||||||
|
.asRuntimeException();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw Status.INTERNAL.withCause(e).asRuntimeException();
|
throw Status.INTERNAL.withCause(e).asRuntimeException();
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue