X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fsharding%2FPrefixedShardConfigWriter.java;h=dcb879bd0de29f0fabebfea856b6925532d8323c;hb=refs%2Fchanges%2F00%2F84600%2F3;hp=2342e5eeb9c933ebd80a9bc80fe4d9410f901239;hpb=6602310b78b5bf54899456e2efa867d116731267;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/PrefixedShardConfigWriter.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/PrefixedShardConfigWriter.java index 2342e5eeb9..dcb879bd0d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/PrefixedShardConfigWriter.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/PrefixedShardConfigWriter.java @@ -20,7 +20,6 @@ import org.opendaylight.controller.cluster.databroker.actors.dds.ClientSnapshot; import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction; import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient; import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils; -import org.opendaylight.mdsal.common.api.ReadFailedException; import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor; import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -108,15 +107,15 @@ class PrefixedShardConfigWriter { boolean checkDefaultIsPresent() { final NodeIdentifierWithPredicates pag = - new NodeIdentifierWithPredicates(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME, - YangInstanceIdentifier.EMPTY); + NodeIdentifierWithPredicates.of(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) { + return snapshot.exists(defaultId).get(); + } catch (InterruptedException | ExecutionException e) { LOG.error("Presence check of default shard in configuration failed.", e); return false; } finally { @@ -139,7 +138,7 @@ class PrefixedShardConfigWriter { final MapEntryNode newEntry = ImmutableMapEntryNodeBuilder.create() .withNodeIdentifier( - new NodeIdentifierWithPredicates(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME, + NodeIdentifierWithPredicates.of(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME, path)) .withChild(ImmutableLeafNodeBuilder.create() .withNodeIdentifier(new NodeIdentifier(ClusterUtils.SHARD_PREFIX_QNAME)) @@ -170,7 +169,7 @@ class PrefixedShardConfigWriter { ClusterUtils.SHARD_LIST_PATH.getPathArguments().forEach(cursor::enter); cursor.delete( - new NodeIdentifierWithPredicates(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME, path)); + NodeIdentifierWithPredicates.of(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME, path)); cursor.close(); return tx.ready();