@Override protected Object doExecute() throws Exception { printInitCommand("remove protocol"); IProtocolManager protocolManager = getProtocolManager(); IResourceManager manager = getResourceManager(); String[] argsRouterName = new String[2]; try { argsRouterName = splitResourceName(resourceId); } catch (Exception e) { printError(e.getMessage()); printEndCommand(); return -1; } IResourceIdentifier resourceIdentifier = manager.getIdentifierFromResourceName(argsRouterName[0], argsRouterName[1]); IProtocolSessionManager sessionManager = protocolManager.getProtocolSessionManager(resourceIdentifier.getId()); if (!optionAll && (sessionId == null || sessionId.contentEquals(""))) { printError("Either specify a session id or --all."); } if (optionAll) { for (String sessionID : sessionManager.getAllProtocolSessionIds()) { sessionManager.destroyProtocolSession(sessionID); } } else sessionManager.destroyProtocolSession(sessionId); printEndCommand(); return null; }