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%2Fdatastore%2Fshardstrategy%2FModuleShardStrategy.java;h=fc7ebd94dd481c909ba6e4d65d205e41cbfdebbf;hb=c74d5c2399e500fe3e690edc8cee497b1cb6f867;hp=fe6f740d279ef5a2ea6a8fad7922e57ab7e1b135;hpb=d83a4d45f6ddbd66842a43dcb230f2c81af91696;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java index fe6f740d27..fc7ebd94dd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java @@ -9,7 +9,9 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy; import org.opendaylight.controller.cluster.datastore.Configuration; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; + +import java.util.List; public class ModuleShardStrategy implements ShardStrategy { @@ -24,7 +26,12 @@ public class ModuleShardStrategy implements ShardStrategy { this.configuration = configuration; } - @Override public String findShard(InstanceIdentifier path) { - return configuration.getShardNamesFromModuleName(moduleName).get(0); + @Override public String findShard(YangInstanceIdentifier path) { + List shardNames = + configuration.getShardNamesFromModuleName(moduleName); + if(shardNames.size() == 0){ + return DefaultShardStrategy.DEFAULT_SHARD; + } + return shardNames.get(0); } }