[SNMP4J] UsmStatsnotintimewindow Report

jones vinu jones_vinu at yahoo.com
Tue Feb 26 13:24:16 CET 2008


Hi all,
   
I have used the below code to create snmp instance in
my factory class similar to approach in tool
snmpRequest since security protocol is a singleton, 
Do we need to share the Usm between session.I get an
snmp report UsmStatsnotinwindow not very frequently in
my application. Is this due to the way USM instance is
used.

 public Snmp getSession() {

        // Create the session
        Snmp session;
        try {
            UdpTransportMapping transportMapping = new
BlockingUdpTransportMapping(m_executor);
           
transportMapping.setAsyncMsgProcessingSupported(false);
// Disable it to get performance
            MessageDispatcher mtDispatcher = new
MessageDispatcherImpl();
   
            mtDispatcher.addMessageProcessingModel(new
MPv3());

        
           
SecurityProtocols.getInstance().addDefaultProtocols();

           
            session = new Snmp(mtDispatcher,
transportMapping);

            USM usm = new
USM(SecurityProtocols.getInstance(),
                    new
OctetString(MPv3.createLocalEngineID()), 0);
           
SecurityModels.getInstance().addSecurityModel(usm);

            session.listen(); // start listening for
requests
            TimeoutModel timeoutModel =
m_retriesStrategy.getTimeoutModel(); 
            session.setTimeoutModel(timeoutModel);

        } catch (SocketException e) {
            m_log.error("SocketException creating the
SNMP session: " + e.getMessage(), e);
            throw new
SnmpException(SnmpException.SnmpInternalError);
        } catch (IOException e) {
            m_log.error("IOException creating the SNMP
session: " + e.getMessage(), e);
            throw new
SnmpException(SnmpException.SnmpInternalError);
        }
        return session;
    }

Snmp session = m_factory.getSession();               
session.getUSM().addUser(getSecurityName(),getUsmUser());


Thanks & Regards
Jones


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the SNMP4J mailing list