Hi all,
I want to know whether there is any difference between the following scenarios in a multi-threaded environment :
Say we have a function aMethod() that can be executed by more than one
thread at a time in a class whose pseudo-code is something like :
Now, AFAIK insert and delete operations in aMethod() requires obtaining exclusive locks on the respective tables, so no one thread can ever insert into table A before its lock is released by the owning thread with a commit or rollback; effectively there is always only one thread executing inside aMethod()
ant the other threads are waiting for the locks to be released. Am i right?
Is this situation the same with the following scenario, where access to aMethod() is synchronized? Here, still no two threads can be in aMethod() simultaneously, right?
Thanks in advance...