Spring Tests : transaction not rolling back after test method executed?

Not automatically, no. The problem is that the two extra threads don't participate in the transaction, hence their actions don't rollback.

Not automatically, no. The problem is that the two extra threads don't participate in the transaction, hence their actions don't rollback. What is the purpose of the two parallel executions?

You will unlikely be able to test for concurrency issues with this approach, if that is what you're aiming for. Edit: The problem is that testing for concurrency issues is very hard, because your tests are, at best, probabilistic ­­­­– success or failure depend on subtle timing issues that may only surface on the billionth run. See this Serverside article for a good summary of the basics.

The rule of thumb should be to avoid hand-coding threading whenever possible, as it is hard to get right and difficult to test. If you can, avoid shared state between threads, and if there is no way around it, rely on the concurrent data structures and asynchronous executors from the java.util. Concurrent package.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions