Originally posted by balaji anatha padmanaban:
Hi steve,
Thanks for your reply.
THe problem is the method should not exceute paralley,you mentioned that. "synchronized just prevent it from being executed twice at the same time".This condition we need .
If the method run twice seperately that's not the problem because we are checking the tables with key's.
If all you need to do is prevent simultaneous execution, and not duplicate calls, then synchronization is what you need. Now you have to ask yourself if both nodes using the same instance of the class with the method you want to synchronize? If they are, then synchronizing the method should be fine. But if they both are using different instances you will have to synchronize on something else that both nodes do share.