title: Transaction like programming in Java
body: <p>I want to achieve transaction like functionality in java. I want to do `<em>n</em>' operations like- one operation to update database, one to insert in a queue, one operation to update another data structure etc., All these operations should behave as one transaction, i.e., if it succeeds, all the operations should be successfully done, otherwise, if one fails, everything should fail. One of the brute force approach is to write try-catch blocks and revert all the operations in catch blocks. Any pointers in solving these type of problems? Is there any pattern or library for achieving this?</p>