Fix incorrect remove call in ShardManager 49/44949/1
authorTom Pantelis <tpanteli@brocade.com>
Wed, 31 Aug 2016 16:21:38 +0000 (12:21 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Wed, 31 Aug 2016 16:21:38 +0000 (12:21 -0400)
THe method onRemoveServerReply calls shardReplicaOperationsInProgress.remove
passing the ShardIdentifier however the shardReplicaOperationsInProgress
Set contains shard name Strings. We need to pass shardId.getShardName().

Change-Id: I3441fe8bbe88d65d20f8d9e8d572865f3cd381d8
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java

index c1bd716..8386e66 100644 (file)
@@ -307,7 +307,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
     private void onRemoveServerReply(ActorRef originalSender, ShardIdentifier shardId, RemoveServerReply replyMsg,
             String leaderPath) {
-        shardReplicaOperationsInProgress.remove(shardId);
+        shardReplicaOperationsInProgress.remove(shardId.getShardName());
 
         LOG.debug ("{}: Received {} for shard {}", persistenceId(), replyMsg, shardId.getShardName());
 
@@ -1094,12 +1094,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         findPrimary(shardName, new AutoFindPrimaryFailureResponseHandler(getSender(), shardName, persistenceId(), getSelf()) {
             @Override
             public void onRemotePrimaryShardFound(RemotePrimaryShardFound response) {
-                getSelf().tell(new RunnableMessage() {
-                    @Override
-                    public void run() {
-                        addShard(getShardName(), response, getSender());
-                    }
-                }, getTargetActor());
+                getSelf().tell((RunnableMessage) () -> addShard(getShardName(), response, getSender()), getTargetActor());
             }
 
             @Override
@@ -1256,12 +1251,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             }
 
             private void doRemoveShardReplicaAsync(final String primaryPath) {
-                getSelf().tell(new RunnableMessage() {
-                    @Override
-                    public void run() {
-                        removeShardReplica(shardReplicaMsg, getShardName(), primaryPath, getSender());
-                    }
-                }, getTargetActor());
+                getSelf().tell((RunnableMessage) () -> removeShardReplica(shardReplicaMsg, getShardName(), primaryPath, getSender()), getTargetActor());
             }
         });
     }
@@ -1380,12 +1370,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                             String.format("Failed to find local shard %s", shardName), failure)), self());
                 } else {
                     if(response instanceof LocalShardFound) {
-                        getSelf().tell(new RunnableMessage() {
-                            @Override
-                            public void run() {
-                                onLocalShardFound.accept((LocalShardFound) response);
-                            }
-                        }, sender);
+                        getSelf().tell((RunnableMessage) () -> onLocalShardFound.accept((LocalShardFound) response), sender);
                     } else if(response instanceof LocalShardNotFound) {
                         String msg = String.format("Local shard %s does not exist", shardName);
                         LOG.debug ("{}: {}", persistenceId, msg);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.