/** For SNMP Runtime internal use only. */ final void invokeOnResponse(Object resp) { if (resp != null) { if (resp instanceof SnmpPduRequestType) responsePdu = (SnmpPduRequestType) resp; else return; } setRequestStatus(stReceivedReply); queueResponse(); }
/** This method cancels an active inform request and removes it from the polling list. */ private void stopRequest() { // Remove the clause synchronized of the stopRequest method. // Synchronization is isolated as possible to avoid thread lock. // Note: the method removeRequest from SendQ is synchronized. // fix bug jaw.00392.B // synchronized (this) { setRequestStatus(stAborted); } informSession.getSnmpQManager().removeRequest(this); synchronized (this) { requestId = 0; } }
/** Calls the user implementation of the <CODE>SnmpInformHandler</CODE> interface. */ private void handleInternalError(String msg) { setRequestStatus(stInternalError); if (reason == null) reason = msg; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpInformRequest.class.getName(), "handleInternalError", "Snmp error/index = " + snmpErrorToString(errorStatus) + "/" + errorIndex + ". Invoking internal error user defined callback...\n" + getVarBindList()); } deleteRequest(); notifyClient(); requestPdu = null; responsePdu = null; internalVarBind = null; try { if (callback != null) callback.processSnmpInternalError(this, reason); } catch (Exception e) { // catch any exception a user might not handle. if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpInformRequest.class.getName(), "handleInternalError", "Exception generated by user callback", e); } } catch (OutOfMemoryError ome) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpInformRequest.class.getName(), "handleInternalError", "OutOfMemory Error generated by user callback", ome); } Thread.currentThread().yield(); } }
/** For SNMP Runtime internal use only. */ final void setRequestSentTime(long sendtime) { numTries++; setPrevPollTime(sendtime); waitTimeForResponse = prevPollTime + timeout * numTries; setRequestStatus(stWaitingForReply); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpInformRequest.class.getName(), "setRequestSentTime", "Inform request Successfully sent"); } informSession.getSnmpQManager().addWaiting(this); }
/** Calls the user implementation of the <CODE>SnmpInformHandler</CODE> interface. */ private void handleSuccess() { setRequestStatus(stResultsAvailable); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpInformRequest.class.getName(), "handleSuccess", "Invoking user defined callback..."); } deleteRequest(); // delete only non-poll request. notifyClient(); requestPdu = null; // responsePdu = null; internalVarBind = null; try { // catch all user exception which may happen in callback. if (callback != null) callback.processSnmpPollData(this, errorStatus, errorIndex, getVarBindList()); } catch (Exception e) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpInformRequest.class.getName(), "handleSuccess", "Exception generated by user callback", e); } } catch (OutOfMemoryError ome) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpInformRequest.class.getName(), "handleSuccess", "OutOfMemory Error generated by user callback", ome); } Thread.currentThread().yield(); } return; }
/** * This method creates a new request ID. The ID is submitted to the poll server for scheduling. */ private void schedulePoll() { numTries = 0; initNewRequest(); setRequestStatus(stWaitingToSend); informSession.getSnmpQManager().addRequest(this); }