-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
10, 11
ADDITIONAL SYSTEM INFORMATION :
Windows 7 Prof 64-bit
A DESCRIPTION OF THE PROBLEM :
The following code appears in the method:
...
Node<K,V> r = new ReservationNode<K,V>();
synchronized (r) {
...
}
r contains a new instance r1 of ReservationNode created in the current thread T1. It is not possible for another thread T2 to see r1. Thus there can be no contention for r1 between T1 and T2. Synchronizing on (the contents of) a local variable cannot prevent concurrent access to the code in the synchronized block.
It is reasonable to assume that the code author put this synchronization in to achieve a specific goal. Whatever the specific goal is, it cannot be achieved in this way.
There is a similar synchronization on a local variable in ConcurrentHathMap.compute().
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Inspect the source.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Agreement that the synchronisation described has no effect, and may be evidence of a programming error.
ACTUAL -
The source inspected.
Windows 7 Prof 64-bit
A DESCRIPTION OF THE PROBLEM :
The following code appears in the method:
...
Node<K,V> r = new ReservationNode<K,V>();
synchronized (r) {
...
}
r contains a new instance r1 of ReservationNode created in the current thread T1. It is not possible for another thread T2 to see r1. Thus there can be no contention for r1 between T1 and T2. Synchronizing on (the contents of) a local variable cannot prevent concurrent access to the code in the synchronized block.
It is reasonable to assume that the code author put this synchronization in to achieve a specific goal. Whatever the specific goal is, it cannot be achieved in this way.
There is a similar synchronization on a local variable in ConcurrentHathMap.compute().
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Inspect the source.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Agreement that the synchronisation described has no effect, and may be evidence of a programming error.
ACTUAL -
The source inspected.