/** * Stops listening for incoming SNMP Traps */ private void stopListening() { if (transport != null) { try { transport.close(); } catch (IOException ioe) { logger.error("couldn't close connection", ioe); } transport = null; } if (snmp != null) { try { snmp.close(); } catch (IOException ioe) { logger.error("couldn't close snmp", ioe); } snmp = null; } }
/** * Closes the socket and stops the listener thread and socket cleaner timer * (if {@link #getSocketTimeout()} is greater than zero). * * @throws IOException * if the socket cannot be closed. */ @Override public void close() throws IOException { for (SocketEntry socketEntry : sockets.values()) { socketEntry.closeSession(); } super.close(); if (dtlsHandshakeThreadPool != null) { dtlsHandshakeThreadPool.stop(); } sockets.clear(); if (socketCleaner != null) { socketCleaner.cancel(); } socketCleaner = null; dtlsHandshakeThreadPool = null; }
try { if (transport != null) { transport.close(); transport = null;