Hi Chan! =D
Nice code! You really put effort on that, pretty cool =D Sorry for I said wrong "-1" btu you get the idea. Yeah that would be very unlike, but if we put some real world scenario where the business code and some more integration could obfuscate and make that delay happen more often IMO =)
I like those concurrent problems (not in production, of course lol) due you need to think very carefully and in a different way that non-concurrent problem are. I would also give an advice that we could create an
test case using Byteman (from
JBoss) which would intercept any point of the code we want and insert some code (AOP). This way we could replicate some strange scenarios like this one =D
Best regards!
Luan