When I read Reaktive source code, I don't quite un...
# reaktive
j
When I read Reaktive source code, I don't quite understand what the role of the BufferedExecutor class is? Could anyone help me explain?
a
Hello. When you need to submit a task to an
Executor
you normally do it as follows:
Copy code
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.
j
okay I get it, thank you