1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
public void send(PDU pdu, Target target, Object userHandle,
ResponseListener listener) throws SNMPException{
try {
snmp.send(pdu, target, null, listener);
} catch (Exception e) {
logManager.error("Error occurred while sending request", e);
if(e instanceof MessageException && e.getMessage().equalsIgnoreCase(("Socket is closed"))) {
logManager.error("Socket Closed Exception received. Restarting the listener... ");
try {
if(transport != null)
transport.close();
if(snmp != null)
snmp.close();
} catch(Exception ex) {}
snmp = null;
transport = null;
//restart the listening
startListen();
} else
throw new SNMPException(SupervisionErrorCodes.ERR_SNMP_GET_INFO,e);
}
} |