Source:
public void processEvent(GlusterEvent event) { if (event == null) { return; } GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(Guid.createGuidFromString(event.getNodeId())); if (glusterServer == null) { return; } VDS host = vdsDao.get(glusterServer.getId()); if (host == null) { return; } GlusterVolumeEntity vol = glusterVolumeDao.getByName(host.getClusterId(), (String) event.getMessage().get("volume")); if (vol == null) { return; } if (event.getEvent().equalsIgnoreCase("BRICK_DISCONNECTED") || event.getEvent().equalsIgnoreCase("BRICK_CONNECTED")) { GlusterStatus status = event.getEvent().equalsIgnoreCase("BRICK_DISCONNECTED") ? GlusterStatus.DOWN : GlusterStatus.UP; String path = (String) event.getMessage().get("brick"); String peer = (String) event.getMessage().get("peer"); List<VDS> vdsList = vdsDao.getAllForCluster(host.getClusterId()); VDS vds = vdsList.stream() .filter(v -> v.getName().equals(peer) || v.getInterfaces().stream().anyMatch(iface -> iface.getIpv4Address().equals(peer))) .findFirst() .orElse(null); GlusterBrickEntity brick = vds != null ? glusterBrickDao.getBrickByServerIdAndDirectory(vds.getId(), path) : null; if (brick != null) { glusterBrickDao.updateBrickStatus(brick.getId(), status); logBrickStatusChange(vol, status, brick); } else { log.debug("Forcing sync as brick event '{}' received that could not be resolved to brick", event); backend.runInternalAction(VdcActionType.RefreshGlusterVolumeDetails, new GlusterVolumeParameters(vol.getId())); } } }

Target:
public void processEvent(GlusterEvent event) { if (event == null) { log.debug("No event to process!"); return; } GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(Guid.createGuidFromString(event.getNodeId())); if (glusterServer == null) { log.debug("Could not determine gluster server from event '{}'", event); return; } VDS host = vdsDao.get(glusterServer.getId()); if (host == null) { log.debug("No host corresponding to gluster server in '{}'", event); return; } GlusterVolumeEntity vol = glusterVolumeDao.getByName(host.getClusterId(), (String) event.getMessage().get("volume")); if (vol == null) { return; } if (event.getEvent().equalsIgnoreCase(EVENT_BRICK_DISCONNECTED) || event.getEvent().equalsIgnoreCase(EVENT_BRICK_CONNECTED)) { GlusterStatus status = event.getEvent().equalsIgnoreCase(EVENT_BRICK_DISCONNECTED) ? GlusterStatus.DOWN : GlusterStatus.UP; String path = (String) event.getMessage().get(BRICK); String peer = (String) event.getMessage().get(PEER); List<VDS> vdsList = vdsDao.getAllForCluster(host.getClusterId()); VDS vds = vdsList.stream() .filter(v -> v.getName().equals(peer) || v.getInterfaces().stream().anyMatch(iface -> iface.getIpv4Address().equals(peer))) .findFirst() .orElse(null); GlusterBrickEntity brick = vds != null ? glusterBrickDao.getBrickByServerIdAndDirectory(vds.getId(), path) : null; if (brick != null) { glusterBrickDao.updateBrickStatus(brick.getId(), status); logBrickStatusChange(vol, status, brick); } else { log.debug("Forcing sync as brick event '{}' received that could not be resolved to brick", event); backend.runInternalAction(VdcActionType.RefreshGlusterVolumeDetails, new GlusterVolumeParameters(vol.getId())); } } }