Only one ResultListener can be registered with a RequestEvent (by using the method setDestination).
If you use a single RequestEvent among concurrent threads to send requests to multiple devices, then
1. the ResultListener that is set by using RequestEvent.setDestination() in one thread would be reset in another thread.
2. if you register a ResultListener by using
SnmpRequestServer.addResultListener() and not by using
setDestination(), then it results in all the
ResultListeners (even the unintended) of the SnmpRequestServer getting
notified with ResultEvent, if any.
3. the requestID, that is set by using RequestEvent.setRequestID(), will be used in multiple threads, which can result in improper correlation of requests and responses.
So, it is better to use a separate RequestEvent in each thread that sends requests.
Leave a comment on amarnatht's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic