X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Factors%2FDataTreeNotificationListenerRegistrationActor.java;h=7d9118dfbe03bc1e2bb87f4513010c2152202524;hb=c032937639e5bc223deb8ec60fab9315c16edd16;hp=6ab4247310dfce5d96d6716f1841a2f8d63cee21;hpb=12fcdfe39aa26dcba7fd3bb4d4c68e3d02e65c51;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/DataTreeNotificationListenerRegistrationActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/DataTreeNotificationListenerRegistrationActor.java index 6ab4247310..7d9118dfbe 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/DataTreeNotificationListenerRegistrationActor.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/DataTreeNotificationListenerRegistrationActor.java @@ -7,18 +7,19 @@ */ package org.opendaylight.controller.cluster.datastore.actors; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorRef; import akka.actor.Cancellable; import akka.actor.PoisonPill; import akka.actor.Props; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; import java.util.concurrent.TimeUnit; import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor; import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeNotificationListenerRegistration; import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeNotificationListenerRegistrationReply; import org.opendaylight.yangtools.concepts.ListenerRegistration; -import scala.concurrent.duration.Duration; +import scala.concurrent.duration.FiniteDuration; /** * Actor co-located with a shard. It exists only to terminate the registration when @@ -34,7 +35,7 @@ public final class DataTreeNotificationListenerRegistrationActor extends Abstrac private Cancellable killSchedule; @Override - protected void handleReceive(Object message) { + protected void handleReceive(final Object message) { if (message instanceof CloseDataTreeNotificationListenerRegistration) { closeListenerRegistration(); if (isValidSender(getSender())) { @@ -59,7 +60,7 @@ public final class DataTreeNotificationListenerRegistrationActor extends Abstrac registration = null; if (killSchedule == null) { - killSchedule = getContext().system().scheduler().scheduleOnce(Duration.create(killDelay, + killSchedule = getContext().system().scheduler().scheduleOnce(FiniteDuration.create(killDelay, TimeUnit.MILLISECONDS), getSelf(), PoisonPill.getInstance(), getContext().dispatcher(), ActorRef.noSender()); } @@ -75,8 +76,8 @@ public final class DataTreeNotificationListenerRegistrationActor extends Abstrac private final Runnable onClose; public SetRegistration(final ListenerRegistration registration, final Runnable onClose) { - this.registration = Preconditions.checkNotNull(registration); - this.onClose = Preconditions.checkNotNull(onClose); + this.registration = requireNonNull(registration); + this.onClose = requireNonNull(onClose); } } }