Search in sources :

Example 26 with TResult

use of com.navercorp.pinpoint.thrift.dto.TResult in project pinpoint by naver.

the class ThriftMessageToResultConverter method toMessage.

@Override
public ResultResponse toMessage(Object object) {
    if (object instanceof ResponseMessage) {
        final ResponseMessage responseMessage = (ResponseMessage) object;
        final byte[] byteMessage = responseMessage.getMessage();
        final Message<TBase<?, ?>> message = SerializationUtils.deserialize(byteMessage, HeaderTBaseDeserializerFactory.DEFAULT_FACTORY, null);
        if (message == null) {
            throw new IllegalArgumentException("message is null. response message=" + responseMessage);
        }
        final TBase<?, ?> tbase = message.getData();
        if (!(tbase instanceof TResult)) {
            throw new IllegalArgumentException("invalid message data. response message=" + responseMessage + ", data=" + tbase.getClass());
        }
        final TResult result = (TResult) tbase;
        return new ResultResponse() {

            @Override
            public boolean isSuccess() {
                return result.isSuccess();
            }

            @Override
            public String getMessage() {
                return result.getMessage();
            }
        };
    }
    return null;
}
Also used : ResultResponse(com.navercorp.pinpoint.profiler.sender.ResultResponse) TBase(org.apache.thrift.TBase) ResponseMessage(com.navercorp.pinpoint.rpc.ResponseMessage) TResult(com.navercorp.pinpoint.thrift.dto.TResult)

Aggregations

TResult (com.navercorp.pinpoint.thrift.dto.TResult)26 TBase (org.apache.thrift.TBase)10 Test (org.junit.Test)7 ResponseMessage (com.navercorp.pinpoint.rpc.ResponseMessage)4 DataReceiverGroupConfiguration (com.navercorp.pinpoint.collector.thrift.config.DataReceiverGroupConfiguration)3 DefaultPinpointClientFactory (com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)3 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)3 TCPReceiverBean (com.navercorp.pinpoint.collector.receiver.thrift.TCPReceiverBean)2 UDPReceiverBean (com.navercorp.pinpoint.collector.receiver.thrift.UDPReceiverBean)2 FutureListener (com.navercorp.pinpoint.rpc.FutureListener)2 TAgentInfo (com.navercorp.pinpoint.thrift.dto.TAgentInfo)2 TApiMetaData (com.navercorp.pinpoint.thrift.dto.TApiMetaData)2 TSqlMetaData (com.navercorp.pinpoint.thrift.dto.TSqlMetaData)2 TStringMetaData (com.navercorp.pinpoint.thrift.dto.TStringMetaData)2 TCommandEcho (com.navercorp.pinpoint.thrift.dto.command.TCommandEcho)2 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)2 GrpcAgentConnection (com.navercorp.pinpoint.collector.cluster.GrpcAgentConnection)1 PinpointGrpcServer (com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer)1 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)1 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1