Implementation of the Two-phase commit protocol in Java