Bug #2137
Updated by Henning Blohm over 2 years ago
The code in com.zfabrik.impl.resources.NamespaceImpl._getResourceHandleImplNonNull(String) may run into a concurrency situation, where a collected resource handle leads to a repeated tick() and invq adding and then invalidation of a concurrently just newly created resource. h2. Example * Threads T1, T2. * Resource name N Flow: # T1: lookup for N returns value holder with null resource handle. # T1: Goes into looping = true # T1: leaves synchronized block # T2: runs tick() and enters synchronized block # T2: Creates and adds new resource handle # T2: leaves synchronized block # T1: enters synchronized block again # T1: finds that it is looping and the value holder for N is not in the invQ and hence puts it into invQ (although the resource handle is NOT null anymore!!!) # T1: invalidates the resource for N right away h2. Acceptance Criteria * When looping for pending invalidations make sure not to accidentally consider a valid non-null handle as to be invalidated h2. Test Cases * com.zfabrik.test.core.resources.tests.Invalidations.concurrentLookupOfCollectedResource: Concurrent lookup and GCing on weakly held resource.