[SNMP4J] Some notes to Class MOScalar

bernhard.kling at sdm.de bernhard.kling at sdm.de
Tue Jul 3 22:13:54 CEST 2007



Hi,

I am using a subclass of MOScalar, which overrides the 'getValue' and 'setValue' Methods.

The 'getValue' Method of the subclass determins it's return value online, by acessing an application via TCP.
The 'setValue' Method passes the new value online to an application, also via TCP.

Requesting the managed objekts value by a SNMP GET Request works fine.
Setting the managed objekt's value by a SNMP SET Request also works, but shows some noticable points (problems).

1.
During processing of the SET Request the 'getValue' Method was called multiple times.
(If Log-Level was DEBUG: 6 times, otherwise: 2 times).
 
	a: This 'getValue' are additional load for the application accesed via TCP
	b. if 'getValue' failed (throws an exception) 'setValue' also failed.
		Log Snippet (after Failed 'getValue'): 'Failed to process SET request, trying to clean it up...'
	  

Is there any possibility to avoid this coupling of 'setValue' and 'getValue' ?
Is it possible to replace 'getValue()' by 'value' in MoScalar's 'toString' Method ?
Is it possible to replace other occurrences of 'getValue()' by 'value' in MoScalar ?
Especially
	request.setUndoValue(getValue());
may cause undefined results, when 'getValue' determines its result dynamically.
Anyway, the value returned by 'getvalue', need not be the same as before processing the SNMP GET Request. 

	
2. 
If 'setValue' failed and returned SnmpConstants.SNMP_ERROR_GENERAL_ERROR, this was ignored.
(Message of Command line tool: Response received with requestID=663712947, errorIndex=0, errorStatus=Success(0)).
This is caused by the following code snippet:
------------------------------------------------------------------------------------------------
 public void commit(SubRequest request) {
	...
    request.setUndoValue(getValue());
    setValue(vb.getVariable());
    status.setPhaseComplete(true);
    ...
  }
--------------------------------------------------------------------------------------------------

Is it intended, that the 'commit' Method does not evaluat the result of 'setValue' ?


Thanks,
Bernhard



More information about the SNMP4J mailing list