Search in sources :

Example 1 with ClientSnapshot

use of org.opendaylight.controller.cluster.databroker.actors.dds.ClientSnapshot in project controller by opendaylight.

the class PrefixedShardConfigWriter method checkDefaultIsPresent.

boolean checkDefaultIsPresent() {
    final NodeIdentifierWithPredicates pag = new NodeIdentifierWithPredicates(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME, YangInstanceIdentifier.EMPTY);
    final YangInstanceIdentifier defaultId = ClusterUtils.SHARD_LIST_PATH.node(pag);
    final ClientSnapshot snapshot = history.takeSnapshot();
    try {
        return snapshot.exists(defaultId).checkedGet();
    } catch (final ReadFailedException e) {
        LOG.error("Presence check of default shard in configuration failed.", e);
        return false;
    } finally {
        snapshot.abort();
    }
}
Also used : ClientSnapshot(org.opendaylight.controller.cluster.databroker.actors.dds.ClientSnapshot) ReadFailedException(org.opendaylight.mdsal.common.api.ReadFailedException) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)

Aggregations

ClientSnapshot (org.opendaylight.controller.cluster.databroker.actors.dds.ClientSnapshot)1 ReadFailedException (org.opendaylight.mdsal.common.api.ReadFailedException)1 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)1 NodeIdentifierWithPredicates (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates)1