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:
zpencer 2018-04-16 09:54:35 -07:00 committed by GitHub
parent 791a29f63b
commit c04278ea07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -226,7 +226,6 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
@Override
public ListenableFuture<SocketStats> getStats() {
// TODO(zpencer): add transport tracing to in-process server
SettableFuture<SocketStats> ret = SettableFuture.create();
ret.set(null);
return ret;

View File

@ -376,7 +376,14 @@ final class ChannelzProtoUtil {
private static <T> T getFuture(ListenableFuture<T> future) {
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) {
throw Status.INTERNAL.withCause(e).asRuntimeException();
} catch (ExecutionException e) {