/** 停止接收器 */ public void stopRecevice() { try { for (SnmptrapHelper helper : map.values()) { helper.stop(); } } catch (IOException e) { e.printStackTrace(); } }
/** * 加入snmp trap接收器 * * @param tag * @param host * @param port * @param threadSize */ public void addRecevice(String tag, String host, int port, int threadSize) { try { if (map.containsKey("tag")) { System.out.println("已经初始化了相关接收器!!!"); } SnmptrapHelper helper = new SnmptrapHelper(); helper.init(host, port, threadSize); map.put(tag, helper); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }