> I don't think it is accidently. OrderedExecutor has performance advantages > than OrderedScheduler. > > A bit background on this: > > - OrderedScheduler was introduced by me. And I changed existing > OrderedSafeExecutor to be extending from OrderedScheduler. > Trying to standarize to one `OrderedScheduler`. > - I think Matteo noticed performance difference between `executor` and > `scheduler`, so he made the change > > https://github.com/apache/bookkeeper/commit/46171e67e526702487641438144f28b7eb1aa07b > . > So the `executor` is used as the main callback executor, since it just > requires ordering but doesn't need scheduling capability. > the `scheduler` is used for scheduling tasks but doesn't require ordering.
The scheduler does need ordering in one case for explicit Lac. I think we could modify the scheduler, so that we could use the same scheduler object for the executor and for scheduling. Instead of having multiple executors in the scheduler, just create one scheduled executor, which then submits to the executor service after the delay. What I want to achieve here is that, after a operation is submitted to a ledger, it only ever operates on a single thread. If you look at LedgerHandle now, you have to jump around 4 files to deduce which thread methods like handleBookieFailure or sendAddSuccessCallbacks are called on, and even then you can't even be sure, so we wrap everything in synchronized when we don't really need to. -Ivan