[SNMP4J] Code question
JD Bertron
jbertron at sfa.com
Fri Apr 7 23:32:15 CEST 2006
Is there a specific bug/reason why Snmp.java passes null as the transport in
the following send method ?
This has implication on my code because I use the same snmp session object
to send requests and receive traps. I am properly passing a transport with a
0 port so it should assign a random port but it doesn't because the
transport is not really passed on further. I fixed my problem by passing the
transport from the method parameter and everything is fine, but I would like
to know that I'm not breaking anything.
public ResponseEvent send(PDU pdu, Target target,
TransportMapping transport) throws IOException {
if (!pdu.isConfirmedPdu()) {
sendMessage(pdu, target, null);
return null;
}
SyncResponseListener syncResponse = new SyncResponseListener();
synchronized (syncResponse) {
synchronized (sync) {
PduHandle handle = sendMessage(pdu, target, null);
PendingRequest request =
new PendingRequest(handle, syncResponse, target, pdu, target,
transport);
if (logger.isDebugEnabled()) {
logger.debug("New pending request with handle " + handle);
}
pendingRequests.put(handle, request);
long delay =
timeoutModel.getRetryTimeout(0, target.getRetries(),
target.getTimeout());
timer.schedule(request, delay);
}
try {
syncResponse.wait();
}
catch (InterruptedException iex) {
logger.warn(iex);
// ignore
}
}
return syncResponse.response;
}
J.D. Bertron.
SFA Charleston.
843-202-2593.
More information about the SNMP4J
mailing list