When I say "soft" transaction I mean something which doesn't involve persistence in some DB but just logical object modifications. Here's the story.
Plain JAVA application, no frameworks, possibly lots of threads.
- Object Ob, in his separate thread, starts doSomething(). Within doSomething(), this object members and (likely) other objects are modified.
- Ob's Thread is interrupted by some event handler. Someone wants Ob to doSomethingElse() instead of doSomething()!
- Ob completes doSomething() and checks if his thread was interrupted. If yes, I'd like him to:
a) completely undo (rollback) doSomething(),
b) doSomethingElse()
without having to trace any specific change made in doSomething(), also because I could have a lot of different doSomething methods for each object. I'm using no specific frameworks and I'd like to keep it "light", say.
Is there a way to achieve such a behavior?
Thanks a lot in advance!