ScheduledExecutorService with variable delay

前端 未结 5 2096
别那么骄傲
别那么骄傲 2020-12-09 03:44

Suppose I have a task that is pulling elements from a java.util.concurrent.BlockingQueue and processing them.

public void scheduleTask(int delay, TimeUnit ti         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 03:59

    I don't think you can change a fixed rate delay. I think you need to use schedule() to perform a one-shot, and schedule again once that has completed (with a modified time out if required).

提交回复
热议问题