public void run() { size = varBind.size(); try { // Invoke a getBulk operation // /* NPCTE fix for bugId 4492741, esc 0, 16-August-2001 */ final ThreadContext oldContext = ThreadContext.push("SnmpUserData", data); try { if (isTraceOn()) { trace( "run", "[" + Thread.currentThread() + "]:getBulk operation on " + agent.getMibName()); } agent.getBulk(createMibRequest(varBind, version, data), nonRepeat, maxRepeat); } finally { ThreadContext.restore(oldContext); } /* end of NPCTE fix for bugId 4492741 */ } catch (SnmpStatusException x) { errorStatus = x.getStatus(); errorIndex = x.getErrorIndex(); if (isDebugOn()) { debug("run", "[" + Thread.currentThread() + "]:an Snmp error occured during the operation"); debug("run", x); } } catch (Exception x) { errorStatus = SnmpDefinitions.snmpRspGenErr; if (isDebugOn()) { debug( "run", "[" + Thread.currentThread() + "]:a generic error occured during the operation"); debug("run", x); } } if (isTraceOn()) { trace("run", "[" + Thread.currentThread() + "]:operation completed"); } }
public void run() { try { final ThreadContext oldContext = ThreadContext.push("SnmpUserData", data); try { switch (type) { case pduGetRequestPdu: // Invoke a get operation // if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:get operation on " + agent.getMibName()); } agent.get(createMibRequest(varBind, version, data)); break; case pduGetNextRequestPdu: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:getNext operation on " + agent.getMibName()); } // #ifdef DEBUG agent.getNext(createMibRequest(varBind, version, data)); break; case pduSetRequestPdu: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:set operation on " + agent.getMibName()); } agent.set(createMibRequest(varBind, version, data)); break; case pduWalkRequest: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:check operation on " + agent.getMibName()); } agent.check(createMibRequest(varBind, version, data)); break; default: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:unknown operation (" + type + ") on " + agent.getMibName()); } errorStatus = snmpRspGenErr; errorIndex = 1; break; } // end of switch } finally { ThreadContext.restore(oldContext); } } catch (SnmpStatusException x) { errorStatus = x.getStatus(); errorIndex = x.getErrorIndex(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:an Snmp error occured during the operation", x); } } catch (Exception x) { errorStatus = SnmpDefinitions.snmpRspGenErr; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINEST, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:a generic error occured during the operation", x); } } if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp( Level.FINER, SnmpSubRequestHandler.class.getName(), "run", "[" + Thread.currentThread() + "]:operation completed"); } }