private void requestStats(ActiveStatsRequestMessage message) throws HyracksDataException {
try {
ActiveRuntimeId runtimeId = (ActiveRuntimeId) message.getPayload();
IActiveRuntime runtime = runtimes.get(runtimeId);
long reqId = message.getReqId();
if (runtime == null) {
LOGGER.warn("Request stats of a runtime that is not registered " + runtimeId);
((NodeControllerService) serviceCtx.getControllerService()).sendApplicationMessageToCC(
message.getCcId(),
JavaSerializationUtils.serialize(new ActiveStatsResponse(reqId, null, new RuntimeDataException(
ErrorCode.ACTIVE_MANAGER_INVALID_RUNTIME, runtimeId.toString()))),
null);
return;
}
String stats = runtime.getStats();
ActiveStatsResponse response = new ActiveStatsResponse(reqId, stats, null);
((NodeControllerService) serviceCtx.getControllerService()).sendApplicationMessageToCC(message.getCcId(),
JavaSerializationUtils.serialize(response), null);
} catch (Exception e) {
throw HyracksDataException.create(e);
}
}