[SNMP4J] Unregister MO with context doesnt work
Pentzlin, David [Contractor]
David.Pentzlin at commscope.com
Tue Jun 17 08:26:41 CEST 2014
Unregister a managed object will call "public void unregister(ManagedObject mo, OctetString context)" (DefaultMOServer.java).
This will remove the mo from registry (treemap) with "registry.remove(key);"
The problem is the comperator from the treemap registry will call: "compareContextScope(MOScope scope, MOContextScope scope2)"
In this function it will compare first the upperbound and if it is the same it will do:
if (result == 0) {
result = scope.getUpperBound().compareTo(scope2.getLowerBound());
and this is always 1 so the result is always -1 or 1 even if it is exact the same scope. So it will never be removed from registry.
If you unregister without context (context==null) the compare function:
result = o1.getLowerBound().compareTo(o2.getLowerBound());
will return 0 and it will be removed from registry.
More information about the SNMP4J
mailing list