nla/doss — pull request #6 by ato (2013-07-02 06:14:42+00:00)
Title: Transaction prepared state

This adds the prepare state for two-phase-commit. I factored out the state transition table as with more than 3 states all the ifs and error handling were starting to drown out the actual rollback/commit implementation.

You might find the state enum a bit surprising if you haven't seen it before. Java enums are quite different to C enums, they're not named integers. Using enums for a state transitions is a fairly common pattern (try googling "java enum state pattern").