/** * 执行命令 * * @param params 命令 * @return 结果 * @throws RemoteException */ @Override public String command(String params) throws RemoteException { CommandExecutor executor = CommandExecutor.create(params); lock.lock(); commandExecutors.add(executor); lock.unlock(); String result = executor.getResult(); lock.lock(); commandExecutors.remove(executor); lock.unlock(); return result; }//源代码片段来自云代码http://yuncode.net