use of com.tencent.polaris.api.plugin.server.ReportClientRequest in project polaris-java by polarismesh.
the class ReportClientTask method doReport.
private ReportClientResponse doReport(String clientHost, String version) {
BaseEngine engine = BaseEngine.getEngine(shareContext);
ReportClientRequest req = new ReportClientRequest();
req.setClientHost(clientHost);
req.setVersion(version);
ReportClientResponse rsp = null;
long start = System.currentTimeMillis();
ServiceCallResult serviceCallResult = new ServiceCallResult();
try {
rsp = extensions.getServerConnector().reportClient(req);
serviceCallResult.setRetStatus(RetStatus.RetSuccess);
serviceCallResult.setRetCode(ErrorCode.Success.getCode());
} catch (PolarisException e) {
serviceCallResult.setRetStatus(RetStatus.RetFail);
serviceCallResult.setRetCode(e.getCode().getCode());
LOG.warn("fail to report client info(clientHost={}, version={}), cause is {}", clientHost, version, e.getMessage());
}
long delay = System.currentTimeMillis() - start;
serviceCallResult.setDelay(delay);
if (null != engine) {
engine.reportServerCall(serviceCallResult, req.getTargetServer(), "reportClient");
}
return rsp;
}
Aggregations