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;
}
}
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;
}
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());
}
}
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);
}
}
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);
}
Aggregations