private void reset(String[] args) throws Exception { Map controllerMap = TCPServer.getControllerList(); if (!controllerMap.isEmpty()) { Set controllerSet = controllerMap.keySet(); Iterator controllerIterator = controllerSet.iterator(); while (controllerIterator.hasNext()) { Controller ctrl = (Controller) controllerMap.get(controllerIterator.next()); telnet.sendCommand("del " + ctrl.getId()); TCPServer.getControllerList().remove(ctrl.getSessionId()); } } }
/** * 向池中重置视频播放控制类 * * @return */ public static synchronized boolean resetController(Controller ctrl) { try { String sessionId = ctrl.getSessionId(); if (!Commons.isNullorEmptyString(sessionId)) { controllerList.put(sessionId, ctrl); } } catch (Exception e) { return false; } return true; }
/** * 向池中添加视频播放控制类 * * @return */ public static synchronized boolean putController(Controller ctrl) { try { String sessionId = ctrl.getSessionId(); if (!Commons.isNullorEmptyString(sessionId)) { Object object = controllerList.get(sessionId); if (null != object && object instanceof Controller) { Controller temp = (Controller) object; VODResCtrl.getInstance().logout(temp); temp = null; // logger.info("移除原来的控制元素。。。。。。"); } controllerList.put(sessionId, ctrl); // logger.info("添加新的控制元素。。。。。。。"); } } catch (Exception e) { return false; } return true; }