groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: NPE exception on ManagedLinkedList
Date Sun, 07 Jun 2015 14:11:14 GMT
Am 07.06.2015 15:49, schrieb Paolo Di Tommaso:
> Well, the point it that I'm not using any ManagedLinkedList object in my
> code.
> At a first look it seems to me a side effect of this change:

the change made it maybe obvious, but the problem is deeper.

ManagedLinkedList uses a reference manager, which will check elements of 
the list if they are still exist, since the elements are weak or soft 
referenced usually. This manager could be in a thread, but in 
groovy-core it is normally just triggered every now and then. Now, one 
manager handles one ReferenceQueue, but in theory multiple lists can 
share the same multiple manager. Now if the cleanup process is triggered 
by multiple lists "at the same time", there might be multiple threads 
operating the same manager and same ReferenceQueue. I assume it is a 
situation like that, which you experience. Solution are obviously that 
those lists each have their own manager or that the manager adds some 
synchronization to avoid this situation. Not sure yet what the best 
approach is

bye blackdrag

Jochen "blackdrag" Theodorou

View raw message