We were depending on the order (open first, close second) but
throwing callbacks into the default Scala executor which does
not guarantee any order. Switch to a custom executor which
serializes everything. We can't just use same thread executor
because one of these callbacks joins the thread that would
run the callback.
We were depending on the order (open first, close second) but throwing callbacks into the default Scala executor which does not guarantee any order. Switch to a custom executor which serializes everything. We can't just use same thread executor because one of these callbacks joins the thread that would run the callback.