[Java] java执行命令command →→→→→进入此内容的聊天室

来自 , 2021-02-07, 写在 Java, 查看 157 次.
URL http://www.code666.cn/view/e8b1cbd0
  1. /**
  2.          * 执行命令
  3.          *
  4.          * @param params 命令
  5.          * @return 结果
  6.          * @throws RemoteException
  7.          */
  8.         @Override
  9.         public String command(String params) throws RemoteException {
  10.             CommandExecutor executor = CommandExecutor.create(params);
  11.             lock.lock();
  12.             commandExecutors.add(executor);
  13.             lock.unlock();
  14.             String result = executor.getResult();
  15.             lock.lock();
  16.             commandExecutors.remove(executor);
  17.             lock.unlock();
  18.             return result;
  19.         }//源代码片段来自云代码http://yuncode.net
  20.                        

回复 "java执行命令command"

这儿你可以回复上面这条便签

captcha