X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-cluster-admin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fadmin%2FClusterAdminRpcService.java;fp=opendaylight%2Fmd-sal%2Fsal-cluster-admin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fadmin%2FClusterAdminRpcService.java;h=4012f2c70914c618c705a92a340ef99dc448fef6;hp=1bff714179c7ce9cb4e99d8b0cb965dcd7b90ba6;hb=f83b2d36fdd7e953ba72492ffb684cd112aa04a6;hpb=800b391dd8f6c0d4de0e7cf9e65961146e2f6c94;ds=sidebyside diff --git a/opendaylight/md-sal/sal-cluster-admin-impl/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java b/opendaylight/md-sal/sal-cluster-admin-impl/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java index 1bff714179..4012f2c709 100644 --- a/opendaylight/md-sal/sal-cluster-admin-impl/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java +++ b/opendaylight/md-sal/sal-cluster-admin-impl/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java @@ -45,7 +45,7 @@ import org.opendaylight.controller.cluster.datastore.messages.RemovePrefixShardR import org.opendaylight.controller.cluster.datastore.messages.RemoveShardReplica; import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot; import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshotList; -import org.opendaylight.controller.cluster.datastore.utils.ActorContext; +import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils; import org.opendaylight.controller.cluster.raft.client.messages.GetSnapshot; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; @@ -124,7 +124,7 @@ public class ClusterAdminRpcService implements ClusterAdminService { this.serializer = serializer; this.makeLeaderLocalTimeout = - new Timeout(configDataStore.getActorContext().getDatastoreContext() + new Timeout(configDataStore.getActorUtils().getDatastoreContext() .getShardLeaderElectionTimeout().duration().$times(2)); } @@ -213,15 +213,14 @@ public class ClusterAdminRpcService implements ClusterAdminService { return newFailedRpcResultFuture("A valid DataStoreType must be specified"); } - ActorContext actorContext = dataStoreType == DataStoreType.Config - ? configDataStore.getActorContext() - : operDataStore.getActorContext(); + ActorUtils actorUtils = dataStoreType == DataStoreType.Config + ? configDataStore.getActorUtils() : operDataStore.getActorUtils(); LOG.info("Moving leader to local node {} for shard {}, datastoreType {}", - actorContext.getCurrentMemberName().getName(), shardName, dataStoreType); + actorUtils.getCurrentMemberName().getName(), shardName, dataStoreType); final scala.concurrent.Future localShardReply = - actorContext.findLocalShardAsync(shardName); + actorUtils.findLocalShardAsync(shardName); final scala.concurrent.Promise makeLeaderLocalAsk = akka.dispatch.Futures.promise(); localShardReply.onComplete(new OnComplete() { @@ -233,11 +232,11 @@ public class ClusterAdminRpcService implements ClusterAdminService { makeLeaderLocalAsk.failure(failure); } else { makeLeaderLocalAsk - .completeWith(actorContext + .completeWith(actorUtils .executeOperationAsync(actorRef, MakeLeaderLocal.INSTANCE, makeLeaderLocalTimeout)); } } - }, actorContext.getClientDispatcher()); + }, actorUtils.getClientDispatcher()); final SettableFuture> future = SettableFuture.create(); makeLeaderLocalAsk.future().onComplete(new OnComplete() { @@ -253,7 +252,7 @@ public class ClusterAdminRpcService implements ClusterAdminService { LOG.debug("Leadership transfer complete"); future.set(RpcResultBuilder.success(new MakeLeaderLocalOutputBuilder().build()).build()); } - }, actorContext.getClientDispatcher()); + }, actorUtils.getClientDispatcher()); return future; } @@ -626,14 +625,14 @@ public class ClusterAdminRpcService implements ClusterAdminService { private void sendMessageToManagerForConfiguredShards(final DataStoreType dataStoreType, final List, ShardResultBuilder>> shardResultData, final Function messageSupplier) { - ActorContext actorContext = dataStoreType == DataStoreType.Config ? configDataStore.getActorContext() - : operDataStore.getActorContext(); - Set allShardNames = actorContext.getConfiguration().getAllShardNames(); + ActorUtils actorUtils = dataStoreType == DataStoreType.Config ? configDataStore.getActorUtils() + : operDataStore.getActorUtils(); + Set allShardNames = actorUtils.getConfiguration().getAllShardNames(); - LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorContext.getDataStoreName()); + LOG.debug("Sending message to all shards {} for data store {}", allShardNames, actorUtils.getDataStoreName()); for (String shardName: allShardNames) { - ListenableFuture future = this.ask(actorContext.getShardManager(), messageSupplier.apply(shardName), + ListenableFuture future = this.ask(actorUtils.getShardManager(), messageSupplier.apply(shardName), SHARD_MGR_TIMEOUT); shardResultData.add(new SimpleEntry<>(future, new ShardResultBuilder().setShardName(shardName).setDataStoreType(dataStoreType))); @@ -642,16 +641,16 @@ public class ClusterAdminRpcService implements ClusterAdminService { private ListenableFuture> sendMessageToShardManagers(final Object message) { Timeout timeout = SHARD_MGR_TIMEOUT; - ListenableFuture configFuture = ask(configDataStore.getActorContext().getShardManager(), message, timeout); - ListenableFuture operFuture = ask(operDataStore.getActorContext().getShardManager(), message, timeout); + ListenableFuture configFuture = ask(configDataStore.getActorUtils().getShardManager(), message, timeout); + ListenableFuture operFuture = ask(operDataStore.getActorUtils().getShardManager(), message, timeout); return Futures.allAsList(configFuture, operFuture); } private ListenableFuture sendMessageToShardManager(final DataStoreType dataStoreType, final Object message) { ActorRef shardManager = dataStoreType == DataStoreType.Config - ? configDataStore.getActorContext().getShardManager() - : operDataStore.getActorContext().getShardManager(); + ? configDataStore.getActorUtils().getShardManager() + : operDataStore.getActorUtils().getShardManager(); return ask(shardManager, message, SHARD_MGR_TIMEOUT); } @@ -695,7 +694,7 @@ public class ClusterAdminRpcService implements ClusterAdminService { returnFuture.set(resp); } } - }, configDataStore.getActorContext().getClientDispatcher()); + }, configDataStore.getActorUtils().getClientDispatcher()); return returnFuture; }