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>
BUG-650: speed CommitCoordinationTask up

Eliminates synchronized block in favor of a compare-and-swap -- the
logic was doing precisely that anyway.

Change-Id: I9b32ab303eb718e8a0af52526857eead65c2b697
Signed-off-by: Robert Varga <rovarga@cisco.com>
Merge changes I9b32ab30,Iebe4701f

* changes:
  BUG-650: speed CommitCoordinationTask up
  BUG-650: improve transaction chaining performance