package org.opendaylight.controller.cluster.datastore;
-import java.util.concurrent.Executors;
-
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
-
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.Executors;
/**
*
String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
- Object result = actorContext.executeShardOperation(shardName,
+ Object result = actorContext.executeLocalShardOperation(shardName,
new RegisterChangeListener(path, dataChangeListenerActor.path(),
- scope).toSerializable(),
+ scope),
ActorContext.ASK_DURATION
);
- RegisterChangeListenerReply reply = RegisterChangeListenerReply.fromSerializable(actorContext.getActorSystem(),result);
- return new DataChangeListenerRegistrationProxy(actorContext.actorSelection(reply.getListenerRegistrationPath()), listener, dataChangeListenerActor);
+ if (result != null) {
+ RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result;
+ return new DataChangeListenerRegistrationProxy(actorContext
+ .actorSelection(reply.getListenerRegistrationPath()), listener,
+ dataChangeListenerActor);
+ }
+
+ LOG.debug(
+ "No local shard for shardName {} was found so returning a noop registration",
+ shardName);
+ return new NoOpDataChangeListenerRegistration(listener);
}
+
+
@Override
public DOMStoreTransactionChain createTransactionChain() {
return new TransactionChainProxy(actorContext, executor, schemaContext);