OF-2966: BOSH events should execute in-order
BOSH related events (mostly: processing of received stanzas) are executed by a worker pool of threads.
Events for each individual session must be processed in the same order in which they are received. Prior to this change, every event was potentially executed by a different worker thread. This can cause some events to be processed (or finish processing) before an earlier event finishes execution in another worker thread.
This commit adds FIFO-based queuing of events, that ensures that events that belong to the same session are processed:
- by only one thread from the worker pool;
- in the same order in which they're received.
OF-2966: Periodic clean-up of BOSH working thread queues
In the previous commit, a mechanism was introduced that ensures per-session FIFO processing of events, using a queuing mechanism based on Futures.
This commit adds a periodic check to see if any events are queued for sessions that no longer exist, discarding those events if they're found.
The cleanup is intended as a safeguard measure against slow accumulation of non-executable events, which over time could lead to memory starvation.
(cherry picked from commit c80e54bbdd240169dae334647d0d2fb957c7aa25)
Chore: when debug logging, replace string concat of message
Instead of concatenation, use the `{}` construct will prevent building the string until it's actually logged.
Although it's probably a performance improvement, it's mainly a readability improvement.
(cherry picked from commit 741fc5560869663a0fe46bcb1bb565ee92f5c0dd)