Source:
public void handleMultipathHealthReport(VDS vds, Map<String, Object> struct) { if (struct.containsKey(VdsProperties.MULTIPATH_HEALTH)) { Map<String, Object> multipathHealthMap = (Map<String, Object>) struct.get(VdsProperties.MULTIPATH_HEALTH); try { String json = JsonHelper.mapToJson(multipathHealthMap); MessageDigest digest = MessageDigest.getInstance("SHA1"); digest.update(json.getBytes("UTF-8")); byte[] hash = digest.digest(); byte[] previousHash = multipathHealthHash.get(vds.getId()); if (Arrays.equals(hash, previousHash)) { return; } multipathHealthHash.put(vds.getId(), hash); log.info("Multipath health report for host {}: {}", vds.getName(), json); } catch (Exception e) { log.error("failed building multipath events: {}", e.getMessage()); log.debug("Exception", e); return; } if (multipathHealthMap.isEmpty()) { AuditLogable logable = createAuditLogableForHost(vds); auditLogDirector.log(logable, AuditLogType.NO_FAULTY_MULTIPATHS_ON_HOST); return; } List<String> mpathNoValidPaths = new ArrayList<>(); List<String> mpathFailedPaths = new ArrayList<>(); for (Map.Entry<String, ?> value : multipathHealthMap.entrySet()) { String deviceGuid = value.getKey(); Map<String, Object> internalValue = (Map<String, Object>) value.getValue(); Integer validPathsCount = (Integer) internalValue.get(VdsProperties.MULTIPATH_VALID_PATHS); if (validPathsCount.equals(0)) { mpathNoValidPaths.add(deviceGuid); } else { mpathFailedPaths.add(deviceGuid); } } createAuditLog(mpathNoValidPaths, AuditLogType.MULTIPATH_DEVICES_WITHOUT_VALID_PATHS_ON_HOST, vds); createAuditLog(mpathFailedPaths, AuditLogType.FAULTY_MULTIPATHS_ON_HOST, vds); } }

Target:
public void handleMultipathHealthReport(VDS vds, Map<String, Object> struct) { if (struct.containsKey(VdsProperties.MULTIPATH_HEALTH)) { Map<String, Object> multipathHealthMap = (Map<String, Object>) struct.get(VdsProperties.MULTIPATH_HEALTH); byte[] hash; String json; try { json = JsonHelper.mapToJson(multipathHealthMap); MessageDigest digest = MessageDigest.getInstance("SHA1"); digest.update(json.getBytes("UTF-8")); hash = digest.digest(); } catch (Exception e) { log.error("failed building multipath events: {}", e.getMessage()); log.debug("Exception", e); return; } byte[] previousHash = multipathHealthHash.get(vds.getId()); if (Arrays.equals(hash, previousHash)) { return; } multipathHealthHash.put(vds.getId(), hash); log.info("Multipath health report for host {}: {}", vds.getName(), json); if (multipathHealthMap.isEmpty()) { AuditLogable logable = createAuditLogableForHost(vds); auditLogDirector.log(logable, AuditLogType.NO_FAULTY_MULTIPATHS_ON_HOST); return; } List<String> mpathNoValidPaths = new ArrayList<>(); List<String> mpathFailedPaths = new ArrayList<>(); for (Map.Entry<String, Object> value : multipathHealthMap.entrySet()) { String deviceGuid = value.getKey(); Map<String, Object> internalValue = (Map<String, Object>) value.getValue(); Integer validPathsCount = (Integer) internalValue.get(VdsProperties.MULTIPATH_VALID_PATHS); if (validPathsCount.equals(0)) { mpathNoValidPaths.add(deviceGuid); } else { mpathFailedPaths.add(deviceGuid); } } createAuditLog(mpathNoValidPaths, AuditLogType.MULTIPATH_DEVICES_WITHOUT_VALID_PATHS_ON_HOST, vds); createAuditLog(mpathFailedPaths, AuditLogType.FAULTY_MULTIPATHS_ON_HOST, vds); } }