Pass executor to scheduler.

This commit is contained in:
akwizgran
2020-08-06 13:11:12 +01:00
parent d5395d3d01
commit 3aa00ecb3d
14 changed files with 128 additions and 92 deletions

View File

@@ -2,8 +2,8 @@ package org.briarproject.bramble.api.system;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
@@ -16,13 +16,16 @@ import java.util.concurrent.TimeUnit;
public interface TaskScheduler {
/**
* See {@link ScheduledExecutorService#schedule(Runnable, long, TimeUnit)}.
* Submits the given task to the given executor after the given delay.
*/
Future<?> schedule(Runnable task, long delay, TimeUnit unit);
Future<?> schedule(Runnable task, Executor executor, long delay,
TimeUnit unit);
/**
* See {@link ScheduledExecutorService#scheduleWithFixedDelay(Runnable, long, long, TimeUnit)}.
* Submits the given task to the given executor after the given delay,
* and then repeatedly with the given interval between executions
* (measured from the end of one execution to the beginning of the next).
*/
Future<?> scheduleWithFixedDelay(Runnable task, long delay,
long interval, TimeUnit unit);
Future<?> scheduleWithFixedDelay(Runnable task, Executor executor,
long delay, long interval, TimeUnit unit);
}