@Override public Void visit(ReductionKeyVertex vertex) { graphVertex.set(graph.getVertexByReductionKey(vertex.getReductionKey())); return null; }
@Override public List<GraphVertex> calculateImpact(String reductionKey) { m_rwLock.readLock().lock(); try { final GraphVertex vertex = m_g.getVertexByReductionKey(reductionKey); return calculateImpact(vertex); } finally { m_rwLock.readLock().unlock(); } }
@Override public Status getOperationalStatus(String reductionKey) { m_rwLock.readLock().lock(); try { GraphVertex vertex = m_g.getVertexByReductionKey(reductionKey); if (vertex != null) { return vertex.getStatus(); } return null; } finally { m_rwLock.readLock().unlock(); } }
@Override public void handleNewOrUpdatedAlarm(AlarmWrapper alarm) { m_rwLock.writeLock().lock(); try { // Recursively propagate the status updateAndPropagateVertex(m_g, m_g.getVertexByReductionKey(alarm.getReductionKey()), alarm.getStatus()); } finally { m_rwLock.writeLock().unlock(); } }
@Override public void handleAllAlarms(List<AlarmWrapper> alarms) { final Set<String> reductionKeysFromGivenAlarms = new HashSet<>(alarms.size()); m_rwLock.writeLock().lock(); try { for (AlarmWrapper alarm : alarms) { // Recursively propagate the status for all of the given alarms updateAndPropagateVertex(m_g, m_g.getVertexByReductionKey(alarm.getReductionKey()), alarm.getStatus()); // Keep track of the reduction keys that have been processed reductionKeysFromGivenAlarms.add(alarm.getReductionKey()); } for (String missingReductionKey : Sets.difference(m_g.getReductionKeys(), reductionKeysFromGivenAlarms)) { // There is a vertex on the graph that corresponds to this reduction key // but no alarm with this reduction key exists updateAndPropagateVertex(m_g, m_g.getVertexByReductionKey(missingReductionKey), Status.INDETERMINATE); } } finally { m_rwLock.writeLock().unlock(); } }
GraphVertex reductionKeyVertex = m_g.getVertexByReductionKey(reductionKey); if (reductionKeyVertex != null) { updateAndPropagateVertex(g, g.getVertexByReductionKey(reductionKey), reductionKeyVertex.getStatus()); } else { reductionsKeysToLookup.add(reductionKey); final Map<String, AlarmWrapper> lookup = m_alarmProvider.lookup(reductionsKeysToLookup); for (Entry<String, AlarmWrapper> eachEntry : lookup.entrySet()) { updateAndPropagateVertex(g, g.getVertexByReductionKey(eachEntry.getKey()), eachEntry.getValue().getStatus());
GraphVertex reductionKeyVertex = graph.getVertexByReductionKey(reductionKey); sm.handleNewOrUpdatedAlarm(new AlarmWrapper() { @Override