You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was implementing #116 and wondering why my test kept failing - resources not getting cleaned up when expected. I think it's because I uncovered a real bug.
CloseableServiceObjects keeps track of services returned by getService() in an IdentityHashMap-backed set called instances. Then on close it iterates through them all and calls ungetService() to release them.
However, I discovered using the debugger that getService() internally increments the use count every time you call it, even if it returns the exact same service instance as a previous call. So really, you need to make sure that every getService() is paired with an ungetService(), and not simply call it once per service object.
Should be an easy fix (on its way).
The text was updated successfully, but these errors were encountered:
kriegfrj
added a commit
to kriegfrj/osgi-test
that referenced
this issue
Jun 3, 2020
Was implementing #116 and wondering why my test kept failing - resources not getting cleaned up when expected. I think it's because I uncovered a real bug.
CloseableServiceObjects
keeps track of services returned bygetService()
in anIdentityHashMap
-backed set calledinstances
. Then on close it iterates through them all and callsungetService()
to release them.However, I discovered using the debugger that
getService()
internally increments the use count every time you call it, even if it returns the exact same service instance as a previous call. So really, you need to make sure that everygetService()
is paired with anungetService()
, and not simply call it once per service object.Should be an easy fix (on its way).
The text was updated successfully, but these errors were encountered: