2 * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.common;
10 import io.netty.util.Timeout;
11 import io.netty.util.Timer;
12 import io.netty.util.TimerTask;
13 import java.util.concurrent.RejectedExecutionException;
14 import java.util.concurrent.TimeUnit;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * A NETCONF-specific equivalent of {@link Timer}. It specifically excludes {@link Timer#stop()} from the API surface.
21 public interface NetconfTimer {
23 * Schedules the specified {@link TimerTask} for one-time execution after the specified delay.
24 * See {@link Timer#newTimeout(TimerTask, long, TimeUnit)}.
26 * @param task a TimerTask
27 * @param delay delay to apply
28 * @param unit a TimeUnit
29 * @return a handle which is associated with the specified task
30 * @throws NullPointerException if any argument is {@code null}
31 * @throws IllegalStateException if this timer has been stopped already
32 * @throws RejectedExecutionException if the pending timeouts are too many and creating new timeout can cause
33 * instability in the system
35 Timeout newTimeout(TimerTask task, long delay, TimeUnit unit);