[SNMP4J] Implementing RFC 1213

Frank Fock fock at agentpp.com
Tue Aug 19 23:27:48 CEST 2008


Michelle,

It is correct, that MOScalar and DefaultMOTable are not
synchronized against concurrent access - even not against
concurrent write access.

Nevertheless, you can lock a ManagedObject by calling
http://www.snmp4j.org/agent/doc/org/snmp4j/agent/MOServer.html#lock(java.lang.Object, 
org.snmp4j.agent.ManagedObject)
against concurrent write access (and do not forget to
call unlock afterwards ;-)

This should be enough for almost all cases. However,
if you need more synchronization (i.e., also against
concurrent read access) then you will have to overwrite
the methods in the ManagedObject interface of DefaultMOTable
by subclassing it and introduce your own sync scheme.

Best regards,
Frank

Larson, Michelle R wrote:
> Frank-
> 
> I'm thinking I want to implement a timer that periodically checks the
> table to see if any of the rows are invalid and remove them.  But I'm
> worried about threading issues.  I was planning to call remove on the
> DefaultMOTable for my ipTable, but that class doesn't appear to be
> synchronized, so what happens if I try to remove a row at the same time
> I'm adding one?  What is your recommendation for dealing with such
> concurrency issues?
> 
> Thanks again for your input!
> 
> Michelle Larson
> 
> -----Original Message-----
> From: Frank Fock [mailto:fock at agentpp.com] 
> Sent: Tuesday, August 19, 2008 12:12 AM
> To: Larson, Michelle R
> Cc: SNMP4J at agentpp.org
> Subject: Re: [SNMP4J] Implementing RFC 1213
> 
> Hi Michelle,
> 
> You can also remove rows on events on any other columnar object of that
> or any other table/scalar of the agent.
> 
> If you do so, please make sure that the row removal takes place in the
> *commit* or *cleanup* phase.
> 
> BTW, RFC1213 is obsolete. Use IP-MIB (RFC4293) instead.
> 
> Best regards,
> Frank
> 
> Larson, Michelle R wrote:
>> Hi-
>>     I'm using SNMP4J-Agent version 1.1.3 and I'm trying to implement 
>> RFC 1213.  The problem I'm having is in the ipRouteTable.  The RFC 
>> description says that if the ipRouteType is set to invalid, then the 
>> agent has the option of removing that row from the table.  How would I
> 
>> go about implementing that in my agent?  It appears the SNMP4J-Agent 
>> only allows me to remove rows if they have a RowStatus field, but this
> 
>> table does not have that.  I tried removing the row once I get a 
>> rowChanged notification, but that seems to cause null pointer 
>> exceptions and the agent cannot finish the command to invalidate the
> row.
>> Any input would be appreciated.
>>
>> Thank-you!
>>
>> Michelle Larson
>> Boeing
>> _______________________________________________
>> SNMP4J mailing list
>> SNMP4J at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/snmp4j
> 

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list