private void getCpuInformation(MessageMetrics mb) {
        OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
        Double cpuLoadProcess = Double.valueOf(operatingSystemMXBean.getProcessCpuLoad() * 100);
        Double cpuLoadSystem = Double.valueOf(operatingSystemMXBean.getSystemCpuLoad() * 100);
        mb.setCpuLoadProcess(cpuLoadProcess);
        mb.setCpuLoadSystem(cpuLoadSystem);
    }
private void getCpuInformation ( MessageMetrics mb ) { OperatingSystemMXBean operatingSystemMXBean = ( OperatingSystemMXBean ) ManagementFactory . getOperatingSystemMXBean ( ) ; Double cpuLoadProcess = Double . valueOf ( operatingSystemMXBean . getProcessCpuLoad ( ) * 100 ) ; Double cpuLoadSystem = Double . valueOf ( operatingSystemMXBean . getSystemCpuLoad ( ) * 100 ) ; mb . setCpuLoadProcess ( cpuLoadProcess ) ; mb . setCpuLoadSystem ( cpuLoadSystem ) ; }
/*public String sendDataHTTP(String uri, Object message) {
Gson gson = new Gson();
String data = gson.toJson(message);
String urlServer = CoreEngine.getInstance().getConfig().getUrlH2hWeb() + uri;
System.out.println("Send Request to Server with uri" + urlServer + " and data" + data);
HttpClient client = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(urlServer);
if (data != null) {
httpPost.setEntity(new StringEntity(data, "UTF8"));
}
httpPost.setHeader("Content-type", "application/json");
String result = null;
try {
HttpResponse response = client.execute(httpPost);
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpURLConnection.HTTP_CREATED
|| statusCode == HttpURLConnection.HTTP_OK
|| statusCode == HttpURLConnection.HTTP_ACCEPTED
|| statusCode == HttpURLConnection.HTTP_NO_CONTENT) {
result = EntityUtils.toString(response.getEntity());
System.out.println("Message from H2H server" + result);
} else {
System.err.println("Failed : HTTP error code : "
+ statusCode
+ " for urlServer " + urlServer + "msg "
+ EntityUtils.toString(response.getEntity()));
}
} else {
System.err.println("Failed : Response Null from urlServer : " + urlServer);
}

} catch (IOException e) {
System.err.println("Error while sending dataHttp to " + urlServer + " : " + e);
}
return result;
}