Suppose I have a task that is pulling elements from a java.util.concurrent.BlockingQueue and processing them.
public void scheduleTask(int delay, TimeUnit timeUnit)
{
scheduledExecutorService.scheduleWithFixedDelay(new Task(queue), 0, delay, timeUnit);
}
How can I schedule / reschedule the task if the frequency can be changed dynamically?
- The idea is to take a stream of data updates and propagate them in batch to a GUI
- The user should be able to vary the frequency of updates