return listeners.register(listener);
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
private ObjectRegistration<DOMMountPoint> registerMountPoint(final SimpleDOMMountPoint mountPoint) {
final YangInstanceIdentifier mountPointId = mountPoint.getIdentifier();
synchronized (mountPoints) {
final DOMMountPoint prev = mountPoints.putIfAbsent(mountPointId, mountPoint);
checkState(prev == null, "Mount point %s already exists as %s", mountPointId, prev);
}
- listeners.forEach(listener -> listener.getInstance().onMountPointCreated(mountPointId));
+ listeners.forEach(listener -> {
+ try {
+ listener.getInstance().onMountPointCreated(mountPointId);
+ } catch (final Exception ex) {
+ LOG.error("Listener {} failed on mount point {} created event", listener, mountPoint, ex);
+ }
+ });
return new AbstractObjectRegistration<DOMMountPoint>(mountPoint) {
@Override
};
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
private void unregisterMountPoint(final YangInstanceIdentifier mountPointId) {
synchronized (mountPoints) {
if (mountPoints.remove(mountPointId) == null) {
}
}
- listeners.forEach(listener -> listener.getInstance().onMountPointRemoved(mountPointId));
+ listeners.forEach(listener -> {
+ try {
+ listener.getInstance().onMountPointRemoved(mountPointId);
+ } catch (final Exception ex) {
+ LOG.error("Listener {} failed on mount point {} removed event", listener, mountPointId, ex);
+ }
+ });
}
final class DOMMountPointBuilderImpl implements DOMMountPointBuilder {