Maintain EntityOwnershipStatistics
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / entityownership / DistributedEntityOwnershipService.java
index f782fc24147d0830965de2fe335e3ca603e5a29f..f1d9b43aba35105c2098bf4910f2736302d9b73c 100644 (file)
@@ -62,12 +62,14 @@ public class DistributedEntityOwnershipService implements EntityOwnershipService
     private static final Timeout MESSAGE_TIMEOUT = new Timeout(1, TimeUnit.MINUTES);
 
     private final DistributedDataStore datastore;
+    private final EntityOwnerSelectionStrategyConfig strategyConfig;
     private final ConcurrentMap<Entity, Entity> registeredEntities = new ConcurrentHashMap<>();
     private volatile ActorRef localEntityOwnershipShard;
     private volatile DataTree localEntityOwnershipShardDataTree;
 
-    public DistributedEntityOwnershipService(DistributedDataStore datastore) {
-        this.datastore = datastore;
+    public DistributedEntityOwnershipService(DistributedDataStore datastore, EntityOwnerSelectionStrategyConfig strategyConfig) {
+        this.datastore = Preconditions.checkNotNull(datastore);
+        this.strategyConfig = Preconditions.checkNotNull(strategyConfig);
     }
 
     public void start() {
@@ -220,7 +222,7 @@ public class DistributedEntityOwnershipService implements EntityOwnershipService
 
     protected EntityOwnershipShard.Builder newShardBuilder() {
         return EntityOwnershipShard.newBuilder().localMemberName(datastore.getActorContext().getCurrentMemberName())
-                .ownerSelectionStrategyConfig(EntityOwnerSelectionStrategyConfig.newBuilder().build());
+                .ownerSelectionStrategyConfig(this.strategyConfig);
     }
 
     @VisibleForTesting