[SNMP4J] Notification issues

Frank Fock fock at agentpp.com
Tue Feb 21 22:11:07 CET 2006


Hi Matthias,

Matthias Wiesmann wrote:
> On 21/02/06, Frank Fock <fock at agentpp.com> wrote:
>> Hello Matthias,
>>
>> Thanks for reporting that bug. I have fixed it
>> by enclosing all accessing of the snmpTargetAddrTagIndex
>> instances into a synchronized(snmpTargetAddrTagIndex)
> 
> Why not simply use synchronized collections? You can use
> Collections.synchronizedCollection(Collection c)  and
> Collections.synchronizedMap(Map m)  to get synchronized collectons.
> 

Yes, this would work too if the method
SnmpTargetMIB.getTargetAddrRowsForTag(String tag) would have been
implemented differently. Since it returned the Collection itself,
an user iterating over it would probably get an exception if
the collection changes during iteration.

> Actually, my current code is stress-testing the notification mechanism
> quite a lot, so the issue now pops up regularly so if you want me to
> test the new version, please sent it to me.
>

OK, I will do so.

Cheers,
Frank





More information about the SNMP4J mailing list