List of usage examples for java.lang Long doubleValue
public double doubleValue()
From source file:org.apache.hadoop.hive.ql.udf.UDFToDouble.java
public Double evaluate(Long i) { if (i == null) { return null; } else {/*from ww w . j a v a2 s . c o m*/ return Double.valueOf(i.doubleValue()); } }
From source file:ditl.cli.App.java
protected Double getTimeMul(Long otps, Long dtps) { if (otps != null && dtps != null) return dtps.doubleValue() / otps.doubleValue(); return null;/*from www .j a va2 s .com*/ }
From source file:com.greenpepper.maven.plugin.TestMonitor.java
private String formatElapsedTime(Long runTime) { NumberFormat numberFormat = NumberFormat.getInstance(Locale.ENGLISH); return numberFormat.format(runTime.doubleValue() / 1000); }
From source file:org.apache.hadoop.hbase.client.coprocessor.BigDecimalColumnInterpreter.java
@Override public double divideForAvg(BigDecimal val1, Long paramLong) { return (((paramLong == null) || (val1 == null)) ? (Double.NaN) : val1.doubleValue() / paramLong.doubleValue()); }
From source file:org.apache.metron.performance.load.monitor.writers.Writer.java
public void writeAll() { int i = 0;//ww w .ja va2 s .c o m Date dateOf = new Date(); List<Results> results = new ArrayList<>(); for (AbstractMonitor m : monitors) { Long eps = m.get(); if (eps != null && summaryLookback > 0) { LinkedList<Double> summary = summaries.get(i); addToLookback(eps.doubleValue(), summary); results.add(new Results(m.format(), m.name(), eps, Optional.of(getStats(summary)))); } else { results.add(new Results(m.format(), m.name(), eps, Optional.empty())); } i++; } Writable writable = new Writable(dateOf, results); for (Consumer<Writable> writer : writers) { writer.accept(writable); } }
From source file:edu.nwpu.gemfire.monitor.service.MemberDetailsService.java
public ObjectNode execute(final HttpServletRequest request) throws Exception { String userName = request.getUserPrincipal().getName(); // get cluster object Cluster cluster = Repository.get().getCluster(); // json object to be sent as response ObjectNode responseJSON = mapper.createObjectNode(); JsonNode requestDataJSON = mapper.readTree(request.getParameter("pulseData")); String memberName = requestDataJSON.get("MemberDetails").get("memberName").textValue(); Cluster.Member clusterMember = cluster.getMember(StringUtils.makeCompliantName(memberName)); if (clusterMember != null) { responseJSON.put("memberId", clusterMember.getId()); responseJSON.put("name", clusterMember.getName()); responseJSON.put("host", clusterMember.getHost()); responseJSON.put("clusterId", cluster.getId()); responseJSON.put("clusterName", cluster.getServerName()); responseJSON.put("userName", userName); responseJSON.put("loadAverage", clusterMember.getLoadAverage()); responseJSON.put("sockets", clusterMember.getTotalFileDescriptorOpen()); responseJSON.put("threads", clusterMember.getNumThreads()); responseJSON.put("offHeapFreeSize", clusterMember.getOffHeapFreeSize()); responseJSON.put("offHeapUsedSize", clusterMember.getOffHeapUsedSize()); responseJSON.put("regionsCount", clusterMember.getMemberRegionsList().length); // Number of member clients if (PulseController.getPulseProductSupport().equalsIgnoreCase(PulseConstants.PRODUCT_NAME_SQLFIRE)) { responseJSON.put("numClients", clusterMember.getNumSqlfireClients()); } else {/*from w w w. java2 s. com*/ responseJSON.put("numClients", clusterMember.getMemberClientsHMap().size()); } DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN); Long diskUsageVal = clusterMember.getTotalDiskUsage(); Double diskUsage = diskUsageVal.doubleValue() / 1024; responseJSON.put("diskStorageUsed", Double.valueOf(df2.format(diskUsage))); Cluster.Alert[] alertsList = cluster.getAlertsList(); String status = "Normal"; for (Cluster.Alert alert : alertsList) { if (clusterMember.getName().equals(alert.getMemberName())) { if (alert.getSeverity() == Cluster.Alert.SEVERE) { status = "Severe"; break; } else if (alert.getSeverity() == Cluster.Alert.ERROR) { status = "Error"; } else if (alert.getSeverity() == Cluster.Alert.WARNING) { status = "Warning"; } } } responseJSON.put("status", status); } else { responseJSON.put("errorOnMember", "Member [" + memberName + "] is not available"); } // Send json response return responseJSON; }
From source file:com.googlecode.jchav.chart.Chart.java
/** * @param value the lower bound on the y-axis. *///from w ww .j a v a 2 s.c om public void setMinY(Long value) { chart.getCategoryPlot().getRangeAxis().setLowerBound(value.doubleValue()); }
From source file:com.pivotal.gemfire.tools.pulse.internal.service.MemberDetailsService.java
public JSONObject execute(final HttpServletRequest request) throws Exception { String userName = request.getUserPrincipal().getName(); // get cluster object Cluster cluster = Repository.get().getCluster(); // json object to be sent as response JSONObject responseJSON = new JSONObject(); try {/*from w ww .j av a2 s . c om*/ JSONObject requestDataJSON = new JSONObject(request.getParameter("pulseData")); String memberName = requestDataJSON.getJSONObject("MemberDetails").getString("memberName"); responseJSON.put("connectedFlag", cluster.isConnectedFlag()); responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg()); Cluster.Member clusterMember = cluster.getMember(StringUtils.makeCompliantName(memberName)); if (clusterMember != null) { responseJSON.put("memberId", clusterMember.getId()); responseJSON.put("name", clusterMember.getName()); responseJSON.put("host", clusterMember.getHost()); responseJSON.put("clusterId", cluster.getId()); responseJSON.put("clusterName", cluster.getServerName()); responseJSON.put("userName", userName); responseJSON.put("loadAverage", clusterMember.getLoadAverage()); responseJSON.put("sockets", clusterMember.getTotalFileDescriptorOpen()); responseJSON.put("openFDs", clusterMember.getTotalFileDescriptorOpen()); responseJSON.put("threads", clusterMember.getNumThreads()); responseJSON.put("offHeapFreeSize", clusterMember.getOffHeapFreeSize()); responseJSON.put("offHeapUsedSize", clusterMember.getOffHeapUsedSize()); responseJSON.put("regionsCount", clusterMember.getMemberRegionsList().length); // Number of member clients if (PulseController.getPulseProductSupport() .equalsIgnoreCase(PulseConstants.PRODUCT_NAME_GEMFIREXD)) { responseJSON.put("numClients", clusterMember.getNumGemFireXDClients()); } else { responseJSON.put("numClients", clusterMember.getMemberClientsHMap().size()); } DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN); Long diskUsageVal = clusterMember.getTotalDiskUsage(); Double diskUsage = diskUsageVal.doubleValue() / 1024; responseJSON.put("diskStorageUsed", Double.valueOf(df2.format(diskUsage))); Cluster.Alert[] alertsList = cluster.getAlertsList(); String status = "Normal"; for (Cluster.Alert alert : alertsList) { if (clusterMember.getName().equals(alert.getMemberName())) { if (alert.getSeverity() == Cluster.Alert.SEVERE) { status = "Severe"; break; } else if (alert.getSeverity() == Cluster.Alert.ERROR) { status = "Error"; } else if (alert.getSeverity() == Cluster.Alert.WARNING) { status = "Warning"; } } } responseJSON.put("status", status); } else { responseJSON.put("errorOnMember", "Member [" + memberName + "] is not available"); } // Send json response return responseJSON; } catch (JSONException e) { throw new Exception(e); } }
From source file:edu.nwpu.gemfire.monitor.service.ClusterDetailsService.java
public ObjectNode execute(final HttpServletRequest request) throws Exception { String userName = request.getUserPrincipal().getName(); // get cluster object Cluster cluster = Repository.get().getCluster(); // json object to be sent as response ObjectNode responseJSON = mapper.createObjectNode(); Cluster.Alert[] alertsList = cluster.getAlertsList(); int severeAlertCount = 0; int errorAlertCount = 0; int warningAlertCount = 0; int infoAlertCount = 0; for (Cluster.Alert alertObj : alertsList) { if (alertObj.getSeverity() == Cluster.Alert.SEVERE) { severeAlertCount++;/*from w w w .j a v a2s. co m*/ } else if (alertObj.getSeverity() == Cluster.Alert.ERROR) { errorAlertCount++; } else if (alertObj.getSeverity() == Cluster.Alert.WARNING) { warningAlertCount++; } else { infoAlertCount++; } } // getting basic details of Cluster responseJSON.put("clusterName", cluster.getServerName()); responseJSON.put("severeAlertCount", severeAlertCount); responseJSON.put("errorAlertCount", errorAlertCount); responseJSON.put("warningAlertCount", warningAlertCount); responseJSON.put("infoAlertCount", infoAlertCount); responseJSON.put("totalMembers", cluster.getMemberCount()); responseJSON.put("servers", cluster.getServerCount()); responseJSON.put("clients", cluster.getClientConnectionCount()); responseJSON.put("locators", cluster.getLocatorCount()); responseJSON.put("totalRegions", cluster.getTotalRegionCount()); Long heapSize = cluster.getTotalHeapSize(); DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN); Double heapS = heapSize.doubleValue() / 1024; responseJSON.put("totalHeap", Double.valueOf(df2.format(heapS))); responseJSON.put("functions", cluster.getRunningFunctionCount()); responseJSON.put("uniqueCQs", cluster.getRegisteredCQCount()); responseJSON.put("subscriptions", cluster.getSubscriptionCount()); responseJSON.put("txnCommitted", cluster.getTxnCommittedCount()); responseJSON.put("txnRollback", cluster.getTxnRollbackCount()); responseJSON.put("userName", userName); return responseJSON; }
From source file:com.pivotal.gemfire.tools.pulse.internal.service.ClusterDetailsService.java
public JSONObject execute(final HttpServletRequest request) throws Exception { String userName = request.getUserPrincipal().getName(); // get cluster object Cluster cluster = Repository.get().getCluster(); // json object to be sent as response JSONObject responseJSON = new JSONObject(); Cluster.Alert[] alertsList = cluster.getAlertsList(); int severeAlertCount = 0; int errorAlertCount = 0; int warningAlertCount = 0; int infoAlertCount = 0; for (Cluster.Alert alertObj : alertsList) { if (alertObj.getSeverity() == Cluster.Alert.SEVERE) { severeAlertCount++;//from www . j av a2 s . co m } else if (alertObj.getSeverity() == Cluster.Alert.ERROR) { errorAlertCount++; } else if (alertObj.getSeverity() == Cluster.Alert.WARNING) { warningAlertCount++; } else { infoAlertCount++; } } try { // getting basic details of Cluster responseJSON.put("clusterName", cluster.getServerName()); responseJSON.put("severeAlertCount", severeAlertCount); responseJSON.put("errorAlertCount", errorAlertCount); responseJSON.put("warningAlertCount", warningAlertCount); responseJSON.put("infoAlertCount", infoAlertCount); responseJSON.put("totalMembers", cluster.getMemberCount()); responseJSON.put("servers", cluster.getServerCount()); responseJSON.put("clients", cluster.getClientConnectionCount()); responseJSON.put("locators", cluster.getLocatorCount()); responseJSON.put("totalRegions", cluster.getTotalRegionCount()); Long heapSize = cluster.getTotalHeapSize(); DecimalFormat df2 = new DecimalFormat(PulseConstants.DECIMAL_FORMAT_PATTERN); Double heapS = heapSize.doubleValue() / 1024; responseJSON.put("totalHeap", Double.valueOf(df2.format(heapS))); responseJSON.put("functions", cluster.getRunningFunctionCount()); responseJSON.put("uniqueCQs", cluster.getRegisteredCQCount()); responseJSON.put("subscriptions", cluster.getSubscriptionCount()); responseJSON.put("txnCommitted", cluster.getTxnCommittedCount()); responseJSON.put("txnRollback", cluster.getTxnRollbackCount()); responseJSON.put("userName", userName); responseJSON.put("connectedFlag", cluster.isConnectedFlag()); responseJSON.put("connectedErrorMsg", cluster.getConnectionErrorMsg()); return responseJSON; } catch (JSONException e) { throw new Exception(e); } }