[ONOS-6487] Catch and log exceptions that occur during replication in ECM

Change-Id: I27135677af1331f1782739adc7eeb517a623e119
This commit is contained in:
Jordan Halterman 2017-05-18 12:52:51 -07:00 committed by Jonathan Hart
parent b6e0e914ce
commit e0fae910b1

View File

@ -922,15 +922,19 @@ public class EventuallyConsistentMapImpl<K, V>
items.forEach(item -> map.compute(item.key(), (key, existing) ->
item.isNewerThan(existing) ? item : existing));
communicationExecutor.execute(() -> {
clusterCommunicator.unicast(ImmutableList.copyOf(map.values()),
updateMessageSubject,
serializer::encode,
peer)
.whenComplete((result, error) -> {
if (error != null) {
log.debug("Failed to send to {}", peer, error);
}
});
try {
clusterCommunicator.unicast(ImmutableList.copyOf(map.values()),
updateMessageSubject,
serializer::encode,
peer)
.whenComplete((result, error) -> {
if (error != null) {
log.debug("Failed to send to {}", peer, error);
}
});
} catch (Exception e) {
log.warn("Failed to send to {}", peer, e);
}
});
}
}