Search in sources :

Example 1 with ListSpanReceiversResponseProto

use of org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversResponseProto in project hadoop by apache.

the class TraceAdminProtocolTranslatorPB method listSpanReceivers.

@Override
public SpanReceiverInfo[] listSpanReceivers() throws IOException {
    ArrayList<SpanReceiverInfo> infos = new ArrayList<SpanReceiverInfo>(1);
    try {
        ListSpanReceiversRequestProto req = ListSpanReceiversRequestProto.newBuilder().build();
        ListSpanReceiversResponseProto resp = rpcProxy.listSpanReceivers(null, req);
        for (SpanReceiverListInfo info : resp.getDescriptionsList()) {
            infos.add(new SpanReceiverInfo(info.getId(), info.getClassName()));
        }
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
    return infos.toArray(new SpanReceiverInfo[infos.size()]);
}
Also used : ServiceException(com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) SpanReceiverListInfo(org.apache.hadoop.tracing.TraceAdminPB.SpanReceiverListInfo) ListSpanReceiversRequestProto(org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversRequestProto) ListSpanReceiversResponseProto(org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversResponseProto)

Example 2 with ListSpanReceiversResponseProto

use of org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversResponseProto in project hadoop by apache.

the class TraceAdminProtocolServerSideTranslatorPB method listSpanReceivers.

@Override
public ListSpanReceiversResponseProto listSpanReceivers(RpcController controller, ListSpanReceiversRequestProto req) throws ServiceException {
    try {
        SpanReceiverInfo[] descs = server.listSpanReceivers();
        ListSpanReceiversResponseProto.Builder bld = ListSpanReceiversResponseProto.newBuilder();
        for (int i = 0; i < descs.length; ++i) {
            bld.addDescriptions(TraceAdminPB.SpanReceiverListInfo.newBuilder().setId(descs[i].getId()).setClassName(descs[i].getClassName()).build());
        }
        return bld.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) IOException(java.io.IOException) ListSpanReceiversResponseProto(org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversResponseProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 ListSpanReceiversResponseProto (org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversResponseProto)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ListSpanReceiversRequestProto (org.apache.hadoop.tracing.TraceAdminPB.ListSpanReceiversRequestProto)1 SpanReceiverListInfo (org.apache.hadoop.tracing.TraceAdminPB.SpanReceiverListInfo)1