BUG-650: improve transaction chaining performance
Transaction chaining has mucked inside SnapshotBackedWriteTransaction to
get its state everytime a new transaction was allocated. Instead we
expose proper lifecycle hooks, so the chain handling logic can keep
track of state itself.
As an added feature, this fixes a bug, where a chain would become
unusable if the user closed a write transaction without actually calling
ready() on it.
Finally it fixes a synchronization bug, where a commit task would not be
properly synchronized with listener registrations.
Change-Id: Iebe4701f1712a95a9316ea8380fe12c8c5fe6b89
Signed-off-by: Robert Varga <rovarga@cisco.com>