Skip to content
Advertisement

Tag: scheduledexecutorservice

ScheduledExecutorService not executing task with an initialDelay 0

ScheduledExecutorService not executing a submitted task with an initialDelay of 0 time units when using scheduleWithFixedDelay or scheduleAtFixedRate. But it is executing the task when i call schedule on it Output But when I use scheduleWithFixedDelay or scheduleAtFixedRate instead of schedule the task is not getting executed. Why is the task not getting executed in this scenario? I expected this

ScheduledExecutorService or ScheduledThreadPoolExecutor

I’m building an Android App which have to periodically do something in a Service. And I found that using ScheduledThreadPoolExecutor and ScheduledExecutorService is preferable to Timer. Can anyone explain the difference between ScheduledExecutorService and ScheduledThreadPoolExecutor and which one is more suitable for Android? Update I just found this article and this post explain the difference between several way to implement

How to remove a task from ScheduledExecutorService?

I have a ScheduledExecutorService that times a few different task periodically with scheduleAtFixedRate(Runnable, INIT_DELAY, ACTION_DELAY, TimeUnit.SECONDS); I also have a different Runnable that I’m using with this scheduler. the problem starts when I want to remove one of the tasks from the scheduler. Is there a way to do this? Am I doing the right thing using one scheduler for

Advertisement