Jeff Beyond
04/27/2020, 10:50 AMArkadii Ivanov
04/27/2020, 11:08 AMExecutor
you normally do it as follows:
executor.submit {
// Your code here
}
If you submit tasks faster than they are actually executed then you will pollute the `Executor`'s queue.
BufferedExecutor
solves this problem. It wraps an Executor
. When a first task is submitted it submits a drainFunction
task to the wrapped Executor
. Then inside this single function it drains the internal queue of submitted tasks until it's empty.Jeff Beyond
04/27/2020, 11:24 AM