* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.target.rev170215.IdSequence;
import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.target.rev170215.IdSequenceBuilder;
import org.slf4j.Logger;
import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.target.rev170215.IdSequence;
import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.target.rev170215.IdSequenceBuilder;
import org.slf4j.Logger;
public PublishNotificationsTask(final NotificationPublishService notificationPublishService,
final String notificationId, final long secondsToTake, final long maxPerSecond) {
public PublishNotificationsTask(final NotificationPublishService notificationPublishService,
final String notificationId, final long secondsToTake, final long maxPerSecond) {
- this.notificationPublishService = notificationPublishService;
- this.notificationId = notificationId;
+ this.notificationPublishService = requireNonNull(notificationPublishService);
+ this.notificationId = requireNonNull(notificationId);
+ checkArgument(secondsToTake > 0);
this.delay = SECOND_AS_NANO / maxPerSecond;
LOG.debug("Delay : {}", delay);
this.delay = SECOND_AS_NANO / maxPerSecond;
LOG.debug("Delay : {}", delay);
LOG.debug("current {}, starttime: {}, timetotake: {}, current-start = {}",
current, startTime, timeToTake, current - startTime);
LOG.debug("current {}, starttime: {}, timetotake: {}, current-start = {}",
current, startTime, timeToTake, current - startTime);
LOG.debug("Sequence number: {}", sequenceNumber);
scheduledFuture.cancel(false);
executor.shutdown();
LOG.debug("Sequence number: {}", sequenceNumber);
scheduledFuture.cancel(false);
executor.shutdown();