design patterns - Transaction like programming in Java -


I want to get functionality such as Java. I want to do operations like ` n - an operation to update the database, to include in a row, to update another data structure, etc. One operation etc., all these tasks I should behave as a transaction, if it succeeds, then all tasks should be done successfully, otherwise, if someone fails then everything should fail. One of the brush force approaches is to write the blocks that catch one and return all the functions in the grip blocks. Any signs in solving these types of problems? Is there a pattern or library to get it?

I think the pattern you are looking for. Similar to the behavior of the transaction, a database engine or software installer can keep a list of actions that would have been done or done. One of them should fail, everyone else can be dismissed or rejected (usually called rollback), for example, if two database tables that refer to each other, they have to be updated, and The second update fails, the transaction can be brought back, so that the first table no longer has an invalid reference.

Comments