
118
int command,
SnmpPduPacket pdu) {
SnmpPduRequest req = null;
if(pdu instanceof SnmpPduRequest) {
req = (SnmpPduRequest)pdu;
//req.getErrorStatus()
}
if(pdu.getCommand() != SnmpPduPacket.RESPONSE) {
log.log( Level.WARNING, "Error: Received non-response command " +
pdu.getCommand());
value = null;
waitingForResponse = false;
synchronized(session) {
session.notifyAll();
}
return;
}
// Passed the checks so lets get the first varbind and
// print out it's value
SnmpVarBind vb = pdu.getVarBindAt(0);
//log.log(Level.FINE, mibModule.getNode( vb.getName().toString() )+":"+vb.getValue() );
log.log(Level.FINE, "Received "+":"+vb.getValue() );
value = vb.getValue();
waitingForResponse = false;
// Wake up the calling thread so it can return a value
synchronized(session) {
session.notifyAll();
}
}
/**
* <p>
* This method is invoked when an agent fails to respond
* in the required time. This method will only be invoked
* if the total retries exceed the number defined by the
* session.
* <p>
*
* @param session The SNMP Session
* @param pdu The PDU object that timed out
*
*/
public void snmpTimeoutError(SnmpSession session, SnmpSyntax pdu) {
log.log(Level.WARNING, "The session timed out trying to communicate with the remote
host");
value = null;
waitingForResponse = false;
// Wake up the blocking request thread
synchronized(session) {
session.notifyAll();
}
}
/**
* <p>
* This method is invoked when an internal error occurs
* for the session. To determine the exact error the
* err parameter should be compared with all the error
* conditions defined in the SnmpSession class.
* </p>
*
* @param session The SNMP session in question
* @param err The error that occured
* @param pdu The PDU object that caused the error
*
*/
public void snmpInternalError(SnmpSession session,
int err,
SnmpSyntax pdu) {
Kommentare zu diesen Handbüchern