Search in sources :

Example 1 with GetTopChannelsResponse

use of io.grpc.channelz.v1.GetTopChannelsResponse in project grpc-java by grpc.

the class ChannelzService method getTopChannels.

/**
 * Returns top level channel aka {@link io.grpc.ManagedChannel}.
 */
@Override
public void getTopChannels(GetTopChannelsRequest request, StreamObserver<GetTopChannelsResponse> responseObserver) {
    InternalChannelz.RootChannelList rootChannels = channelz.getRootChannels(request.getStartChannelId(), maxPageSize);
    GetTopChannelsResponse resp;
    try {
        resp = ChannelzProtoUtil.toGetTopChannelResponse(rootChannels);
    } catch (StatusRuntimeException e) {
        responseObserver.onError(e);
        return;
    }
    responseObserver.onNext(resp);
    responseObserver.onCompleted();
}
Also used : GetTopChannelsResponse(io.grpc.channelz.v1.GetTopChannelsResponse) InternalChannelz(io.grpc.InternalChannelz) StatusRuntimeException(io.grpc.StatusRuntimeException)

Aggregations

InternalChannelz (io.grpc.InternalChannelz)1 StatusRuntimeException (io.grpc.StatusRuntimeException)1 GetTopChannelsResponse (io.grpc.channelz.v1.GetTopChannelsResponse)1