Answer 2
Thank you for your answer, but that doesn't really help me with my problem.
The example above is just an example to indicate the problem. I used two-phased commits in my real application because I do both file manipulations ( moving files between servers) and database manipulations, and I have to make sure that both actions
(moving a file and updating the database) can be completed.
That is why I invented some sort of transactional file move. The prepare phase copies the file to its new location under a temporary filename, the commit phase deletes the file at its source location and renames the file to its original filename at
the destination location.
This mechanism works really good, except sometimes, the final step is not executed, because the application ends before the commit phase is called.
The solution I have found so far is to wait until all workerthreads have completed their work. But this requires some coding in the program itself. I would rather find a way to implement this logic in our framework, so that the user can't forget
to add that code.
The solution you are suggesting: putting the file manipulation logic into separate processes sounds interesting. Can you point me to some information on how to do that?
thanks