Search in sources :

Example 6 with TResult

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

the class AgentInfoHandler method handleRequest.

@Override
public TBase<?, ?> handleRequest(TBase<?, ?> tbase) {
    if (!(tbase instanceof TAgentInfo)) {
        logger.warn("invalid tbase:{}", tbase);
        return null;
    }
    try {
        TAgentInfo agentInfo = (TAgentInfo) tbase;
        logger.debug("Received AgentInfo={}", agentInfo);
        // agent info
        agentInfoDao.insert(agentInfo);
        // for querying agentid using applicationname
        applicationIndexDao.insert(agentInfo);
        return new TResult(true);
    // for querying applicationname using agentid
    //            agentIdApplicationIndexDao.insert(agentInfo.getAgentId(), agentInfo.getApplicationName());
    } catch (Exception e) {
        logger.warn("AgentInfo handle error. Caused:{}", e.getMessage(), e);
        TResult result = new TResult(false);
        result.setMessage(e.getMessage());
        return result;
    }
}
Also used : TAgentInfo(com.navercorp.pinpoint.thrift.dto.TAgentInfo) TResult(com.navercorp.pinpoint.thrift.dto.TResult)

Example 7 with TResult

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

the class DispatchHandlerWrapper method dispatchRequestMessage.

@Override
public TBase dispatchRequestMessage(TBase<?, ?> tBase) {
    if (checkAvaiable()) {
        return this.delegate.dispatchRequestMessage(tBase);
    }
    logger.debug("Handler is disabled. Skipping request message {}.", tBase);
    TResult result = new TResult(false);
    result.setMessage("Handler is disabled. Skipping request message.");
    return result;
}
Also used : TResult(com.navercorp.pinpoint.thrift.dto.TResult)

Example 8 with TResult

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

the class AgentInfoSenderListener method onComplete.

@Override
public void onComplete(Future<ResponseMessage> future) {
    try {
        if (future != null && future.isSuccess()) {
            TBase<?, ?> tbase = deserialize(future);
            if (tbase instanceof TResult) {
                TResult result = (TResult) tbase;
                if (result.isSuccess()) {
                    logger.debug("result success");
                    this.isSuccessful.set(true);
                    return;
                } else {
                    logger.warn("request fail. Caused:{}", result.getMessage());
                }
            } else {
                logger.warn("Invalid Class. {}", tbase);
            }
        }
    } catch (Exception e) {
        logger.warn("request fail. caused:{}", e.getMessage());
    }
}
Also used : TResult(com.navercorp.pinpoint.thrift.dto.TResult)

Example 9 with TResult

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

the class CommandDispatcher method handleRequest.

@Override
public void handleRequest(RequestPacket requestPacket, PinpointSocket pinpointSocket) {
    logger.info("handleRequest packet:{}, remote:{}", requestPacket, pinpointSocket.getRemoteAddress());
    final TBase<?, ?> request = SerializationUtils.deserialize(requestPacket.getPayload(), CommandSerializer.DESERIALIZER_FACTORY, null);
    logger.debug("handleRequest request:{}, remote:{}", request, pinpointSocket.getRemoteAddress());
    TBase response;
    if (request == null) {
        final TResult tResult = new TResult(false);
        tResult.setMessage("Unsupported ServiceTypeInfo.");
        response = tResult;
    } else {
        final ProfilerRequestCommandService service = commandServiceLocator.getRequestService(request);
        if (service == null) {
            TResult tResult = new TResult(false);
            tResult.setMessage("Can't find suitable service(" + request + ").");
            response = tResult;
        } else {
            response = service.requestCommandService(request);
        }
    }
    final byte[] payload = SerializationUtils.serialize(response, CommandSerializer.SERIALIZER_FACTORY, null);
    if (payload != null) {
        pinpointSocket.response(requestPacket, payload);
    }
}
Also used : TBase(org.apache.thrift.TBase) TResult(com.navercorp.pinpoint.thrift.dto.TResult)

Example 10 with TResult

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

the class TCommandRegistryTest method registryTest5.

@Test
public void registryTest5() throws TException {
    TCommandRegistry registry = new TCommandRegistry(TCommandTypeVersion.V_1_0_2_SNAPSHOT);
    Header header = registry.headerLookup(new TResult());
    Assert.assertNotNull(header);
}
Also used : TResult(com.navercorp.pinpoint.thrift.dto.TResult) Test(org.junit.Test)

Aggregations

TResult (com.navercorp.pinpoint.thrift.dto.TResult)11 TBase (org.apache.thrift.TBase)3 Test (org.junit.Test)3 FutureListener (com.navercorp.pinpoint.rpc.FutureListener)2 ResponseMessage (com.navercorp.pinpoint.rpc.ResponseMessage)2 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)2 TAgentInfo (com.navercorp.pinpoint.thrift.dto.TAgentInfo)1 TCommandEcho (com.navercorp.pinpoint.thrift.dto.command.TCommandEcho)1 TCommandTransfer (com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer)1 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)1 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)1 TException (org.apache.thrift.TException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1