X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsamples%2Fclustering-test-app%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fclustering%2Fit%2Fprovider%2Fimpl%2FPublishNotificationsTask.java;fp=opendaylight%2Fmd-sal%2Fsamples%2Fclustering-test-app%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fclustering%2Fit%2Fprovider%2Fimpl%2FPublishNotificationsTask.java;h=4f4b7f8e105d5751346e3196feec763ab69176df;hb=3859df9beca8f13f1ff2b2744ed3470a1715bec3;hp=bd755d40c8b24fc87cb1ff9b608ca1b0970fb8c1;hpb=083a04543a96ae862c48ccb4aaefc667f19d9f1e;p=controller.git diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PublishNotificationsTask.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PublishNotificationsTask.java index bd755d40c8..4f4b7f8e10 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PublishNotificationsTask.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PublishNotificationsTask.java @@ -5,10 +5,11 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.clustering.it.provider.impl; -import com.google.common.base.Preconditions; +import static com.google.common.base.Preconditions.checkArgument; +import static java.util.Objects.requireNonNull; + import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -39,14 +40,12 @@ public class PublishNotificationsTask implements Runnable { public PublishNotificationsTask(final NotificationPublishService notificationPublishService, final String notificationId, final long secondsToTake, final long maxPerSecond) { - Preconditions.checkNotNull(notificationPublishService); - Preconditions.checkNotNull(notificationId); - Preconditions.checkArgument(secondsToTake > 0); - Preconditions.checkArgument(maxPerSecond > 0); - this.notificationPublishService = notificationPublishService; - this.notificationId = notificationId; + this.notificationPublishService = requireNonNull(notificationPublishService); + this.notificationId = requireNonNull(notificationId); + checkArgument(secondsToTake > 0); this.timeToTake = secondsToTake * SECOND_AS_NANO; + checkArgument(maxPerSecond > 0); this.delay = SECOND_AS_NANO / maxPerSecond; LOG.debug("Delay : {}", delay); @@ -76,7 +75,7 @@ public class PublishNotificationsTask implements Runnable { LOG.debug("current {}, starttime: {}, timetotake: {}, current-start = {}", current, startTime, timeToTake, current - startTime); - if ((current - startTime) > timeToTake) { + if (current - startTime > timeToTake) { LOG.debug("Sequence number: {}", sequenceNumber); scheduledFuture.cancel(false); executor.shutdown();