I've created an OSGi issue to clarify whether below snippet is supposed to always work and after discussing this with BJ, that code is bound to fail as there is no strong reference to the coordination. The spec and the CT hint that the thread local (or equivalent construct) which holds the coordination in the implementation must be a weak reference. Therefore with the example below, no one is holding a strong reference to the coordination which then allows it to be garbage collected.
Regards Carsten Am 31.07.15 um 04:48 schrieb Carsten Ziegeler: > Hi, > > Christian brought up an interesting scenario for using the coordinator. > The question is, if the following is a valid scenario: > > coordinator.begin("test", 0); > System.gc(); > coordinator.pop().end(); > > (Of course no one will do a gc() call in his code, its just for > demonstrational purposes) > > The coordination is bound to the thread, but no reference is held. > > Should the coordination be garbage collected? Looking at the CT it > seems, the answer is yes. > > Regards > Carsten > -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev