private List<NetworkAdapterPerformanceData> getNICLogsByRange(String hostname, String domainname, long timestamp) { Connection con = Utility.getPerformanceDBConnection(); List<NetworkAdapterPerformanceData> ret = new ArrayList<NetworkAdapterPerformanceData>(); NetworkAdapterPerformanceData p = null; PreparedStatement com = null; ResultSet rs = null; try { com = con.prepareStatement("select * from rawdatanic where hostname=? and domainname=? and utcdatetime = ?;"); com.setString(1, hostname); com.setString(2, domainname); com.setLong(3, timestamp); rs = com.executeQuery(); while (rs.next()) { p = new NetworkAdapterPerformanceData(); p.setAdapterName(rs.getString("nicid")); p.setKilobytespersecondNetworkReceive(rs.getLong("receiveKBs")); p.setKilobytespersecondNetworkTransmit(rs.getLong("sendKBs")); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(rs.getLong("utcdatetime")); ret.add(p); } } catch (Exception ex) { log.log(Level.ERROR, null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(com); DBUtils.safeClose(con); } return ret; }
try { NetworkAdapterPerformanceData d = new NetworkAdapterPerformanceData(); d.setAdapterName(mp.getRecordNetworkUsage().get(i));