This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Is there a way to make a block of code threadsafe so that even if the requests are coming from two different JVMs altogether (where the EARs are deployed having the same code) they do not access the code in parallel?
Separate JVMs would of course have separate object instances and separate Threads so this gets tricky. Probably some outside entity will have to be involved, say a database or a file representing a "token" which both JVMs can see.
Exactly what is the problem you are trying to solve?