Can isolation level 'serial' produce the same protection as the 'synchronized' keyword?
posted 6 years ago
I'm working on a Java course registration app that contains the following code:
course.getNumberOfOpenings() runs a query to get the number of openings so this situation seems to call for a synchronize block to prevent a swap out of the thread after the number of openings check but before the actual registration but there is no synchronization code of any kind.
However, immediately before this block is executed the isolation level of the JDBC connection is set to 'serial'. Does this isolation level provide the equivalent protection of a synchronized block in this case?