Search in sources :

Example 1 with SimpleDOMMountPoint

use of org.opendaylight.mdsal.dom.spi.SimpleDOMMountPoint in project mdsal by opendaylight.

the class DOMMountPointServiceImpl method registerMountPoint.

@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.streamListeners().forEach(listener -> {
        try {
            listener.onMountPointCreated(mountPointId);
        } catch (final Exception ex) {
            LOG.error("Listener {} failed on mount point {} created event", listener, mountPoint, ex);
        }
    });
    return new AbstractObjectRegistration<>(mountPoint) {

        @Override
        protected void removeRegistration() {
            unregisterMountPoint(getInstance().getIdentifier());
        }
    };
}
Also used : AbstractObjectRegistration(org.opendaylight.yangtools.concepts.AbstractObjectRegistration) SimpleDOMMountPoint(org.opendaylight.mdsal.dom.spi.SimpleDOMMountPoint) DOMMountPoint(org.opendaylight.mdsal.dom.api.DOMMountPoint) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)

Aggregations

DOMMountPoint (org.opendaylight.mdsal.dom.api.DOMMountPoint)1 SimpleDOMMountPoint (org.opendaylight.mdsal.dom.spi.SimpleDOMMountPoint)1 AbstractObjectRegistration (org.opendaylight.yangtools.concepts.AbstractObjectRegistration)1 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)1