Use java.util.Optional in ShardLeaderStateChanged and PrimaryShardInfo
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / utils / ActorContext.java
index 71e6b6491a4b2796e70d446b3bd0da11e9338a66..1bcdd3b27b2ab300304e43a3fe5101d4aa9c71dc 100644 (file)
@@ -234,8 +234,8 @@ public class ActorContext {
     private PrimaryShardInfo onPrimaryShardFound(String shardName, String primaryActorPath,
             short primaryVersion, DataTree localShardDataTree) {
         ActorSelection actorSelection = actorSystem.actorSelection(primaryActorPath);
-        PrimaryShardInfo info = new PrimaryShardInfo(actorSelection, primaryVersion,
-                Optional.fromNullable(localShardDataTree));
+        PrimaryShardInfo info = localShardDataTree == null ? new PrimaryShardInfo(actorSelection, primaryVersion) :
+            new PrimaryShardInfo(actorSelection, primaryVersion, localShardDataTree);
         primaryShardInfoCache.putSuccessful(shardName, info);
         return info;
     }