We do not need a queue in SingleExecutor, i.e. it should be good to use an empty queue -- SynchronousQueue.
But for some reason SynchronousQueue does not work correctly sometimes:
when previous task is done, queue does not accept a new task:
Task java.util.concurrent.FutureTask@3e6bdb53[Not completed, task = com.area9innovation.flow.DatabaseSValue$$Lambda$1400/0x0000000840647040@6ef980b8] rejected from com.area9innovation.flow.FlowRuntime$SingleExecutor@2b1aae93[Running, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 3524
It looks like the task is done, but the worker thread is not ready to accept a new task.
So now we are using queue with capacity 1.
To prevent multiple execution SingleExecutor.activeTasks is used in couple with the builtin reject policy
(but the builtin reject policy cannot reject second execution, only third and more).
We do not need a queue in
SingleExecutor
, i.e. it should be good to use an empty queue --SynchronousQueue
. But for some reasonSynchronousQueue
does not work correctly sometimes: when previous task is done, queue does not accept a new task:It looks like the task is done, but the worker thread is not ready to accept a new task. So now we are using queue with capacity 1. To prevent multiple execution
SingleExecutor.activeTasks
is used in couple with the builtin reject policy (but the builtin reject policy cannot reject second execution, only third and more).