Convert DatastoreSnapshotRestore to OSGi DS
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / LeaderLocalDelegateFactory.java
index fbd974a1da8bb8777721944914b153230bbe954b..af57577c4d37bc08eb5ebd7df92bdd2df2663b31 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.Props;
-import com.google.common.base.Preconditions;
 
 /**
  * Base class for factories instantiating delegates which are local to the
@@ -19,13 +20,12 @@ import com.google.common.base.Preconditions;
  *
  * @param <D> delegate type
  * @param <M> message type
- * @param <I> initial state type
  */
-abstract class LeaderLocalDelegateFactory<M, D, I> extends DelegateFactory<M, D, I> {
+abstract class LeaderLocalDelegateFactory<M> {
     private final Shard shard;
 
     protected LeaderLocalDelegateFactory(final Shard shard) {
-        this.shard = Preconditions.checkNotNull(shard);
+        this.shard = requireNonNull(shard);
     }
 
     protected final ActorRef getSelf() {
@@ -48,19 +48,18 @@ abstract class LeaderLocalDelegateFactory<M, D, I> extends DelegateFactory<M, D,
         return shard.getContext().actorOf(props);
     }
 
-    protected final ActorSelection selectActor(ActorRef ref) {
+    protected final ActorSelection selectActor(final ActorRef ref) {
         return shard.getContext().system().actorSelection(ref.path());
     }
 
-    protected final ActorSelection selectActor(ActorPath path) {
+    protected final ActorSelection selectActor(final ActorPath path) {
         return shard.getContext().system().actorSelection(path);
     }
 
     /**
      * Invoked whenever the local shard's leadership role changes.
      *
-     * @param isLeader true if the shard has become leader, false if it has
- *                 become a follower.
+     * @param isLeader true if the shard has become leader, false if it has become a follower.
      * @param hasLeader true if the shard knows about leader ID
      */
     abstract void onLeadershipChange(boolean isLeader, boolean hasLeader);