[Java] [Java][Android][Process] 暴力的方式执行命令行语句 →→→→→进入此内容的聊天室

来自 , 2020-03-28, 写在 Java, 查看 125 次.
URL http://www.code666.cn/view/55b1927f
  1. public CommandServiceImpl() {
  2.             //线程初始化
  3.             thread = new Thread(CommandServiceImpl.class.getName()) {
  4.                 @Override
  5.                 public void run() {
  6.                     while (thread == this && !this.isInterrupted()) {
  7.                         if (commandExecutors != null && commandExecutors.size() > 0) {
  8.                             lock.lock();
  9.                             LogUtil.i(TAG, "Executors Size:" + commandExecutors.size());
  10.                             for (CommandExecutor executor : commandExecutors) {
  11.                                 if (executor.isTimeOut())
  12.                                     try {
  13.                                         killSelf();
  14.                                     } catch (RemoteException e) {
  15.                                         e.printStackTrace();
  16.                                     }
  17.                                 if (thread != this && this.isInterrupted())
  18.                                     break;
  19.                             }
  20.                             lock.unlock();
  21.                         }
  22.                         try {
  23.                             Thread.sleep(10000);
  24.                         } catch (InterruptedException e) {
  25.                             e.printStackTrace();
  26.                         }
  27.                     }
  28.                 }
  29.             };
  30.             thread.setDaemon(true);
  31.             thread.start();
  32.         }//源代码片段来自云代码http://yuncode.net
  33.  
  34.  
  35.  
  36.  
  37.  
  38.         /**
  39.          * 杀掉自己
  40.          *
  41.          * @throws RemoteException
  42.          */
  43.         @Override
  44.         public void killSelf() throws RemoteException {
  45.             android.os.Process.killProcess(android.os.Process.myPid());
  46.         }//源代码片段来自云代码http://yuncode.net
  47.                        
  48.                        

回复 "[Java][Android][Process] 暴力的方式执行命令行语句"

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

captcha