[SNMP4J] Exception: Timer Already Cancelled

Frank Fock fock at agentpp.com
Mon Mar 24 18:08:53 CET 2008


Hi Robert,

what SNMP4J version are you using?
When do you call Snmp.cancel(..)?
Why are you not using the built-in resend mechanism
of SNMP4J (by incrementing the retry count)?
Are you creating a new PDU instance for each request?
Is the request ID different for each request?

Best regards,
Frank

Robert Stacy wrote:
> Robert Stacy wrote:
>> Hi Everyone,
>>
>> I am currently writing software that polls devices on a network using 
>> SNMP.  I am sending the OID in batches of 5 at a time to the device.  
>> I wait 1 second, and if I have not received all of the replies in that 
>> time I resend the OID that I am missing.  Currently while running the 
>> program  I get the following exception quite often:
>>
>> normal exception: Timer already cancelled.
>> java.lang.IllegalStateException: Timer already cancelled.normal 
>> exception: Timer already cancelled.
>>        at java.util.Timer.sched(Unknown Source)
>>        at java.util.Timer.schedule(Unknown Source)
>>        at org.snmp4j.Snmp$PendingRequest.pduHandleAssigned(Unknown 
>> Source)
>>        at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
>>        at org.snmp4j.Snmp.sendMessage(Unknown Source)
>>
>>        at org.snmp4j.Snmp.send(Unknown Source)
>>        at org.snmp4j.Snmp.send(Unknown Source)
>>
>> Is this because I have already received the response for the request?  
>> Why would I get this exception?
>>
>>
>> Thanks,
>> Rob
>> _______________________________________________
>> SNMP4J mailing list
>> SNMP4J at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>
>>
> I seem to be getting this exception when performing a snmp.send 
> asynchronously.  At no point in my application do I call a snmp.close so 
> that can't be it.  Also, the snmp class is static and 
> created/initialized in a static method.
> 
>    private static final Logger logger = 
> Logger.getLogger(ZCorumSnmpPoller.class);
>    protected static Snmp snmp;
>    protected static ThreadPool snmpThreadPool;
>    private int snmpTimeOut = 1000;
>      static
>    {
>        try
>        {
>            //TODO: Make the number of snmp threads configurable
>            snmpThreadPool = ThreadPool.create("devicePoller", 10);
>            MessageDispatcher dispatcher = new MessageDispatcherImpl();
>            dispatcher.addMessageProcessingModel(new MPv2c());
>            MultiThreadedMessageDispatcher multithreadedDispatcher = new 
> MultiThreadedMessageDispatcher(snmpThreadPool, dispatcher);
>            TransportMapping transport = new DefaultUdpTransportMapping();
>            snmp = new Snmp(multithreadedDispatcher, 
> transport);                      //snmp = new Snmp(transport);
>            transport.listen();
>                  }
>        catch (Exception ex)
>        {
>            ex.printStackTrace();
>                  }
>    }
> 
> 
> I am at a loss as to why I would get this exception.
> 
> Thanks for all your help,
> Rob
> 
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com



More information about the SNMP4J mailing list