MOChangeListener.afterMOChange called twice

Beginning with snmp-agent version 3.6.0, it seems that MOChangeListener.afterMOChange is called twice.

In MOScalar.commit the method changeValue is called which then calls setValue. Afterwards, commit calls the listeners via fireAfterMOChange.

In snmp-agent version 3.6.0, an additional call of fireAfterMOChange has been added to setValue.

Is this intended behavior?

Yes, that is intended (at least partly).

The first call within setValue is done even if the change is not triggered by an SNMP request. If a listener is only interested in changes from SNMP requests, MOChangeEvents with (getSubRequest() == null) can be ignored.

The second call triggered by MOScalar.commit has the sub request set in MOChangEvent.
That is somehow redundant but could not be solved in a better way while providing backward compatibility. This might be optimised with SNMP4J 4.0.