[Java] [Java] Process 创建+控制+分析 →→→→→进入此内容的聊天室

来自 , 2020-05-01, 写在 Java, 查看 103 次.
URL http://www.code666.cn/view/45f31d16
  1. void onExit(int pid, int exitValue) {
  2.         ProcessReference processReference = null;
  3.  
  4.         synchronized (processReferences) {
  5.             cleanUp();
  6.             if (pid >= 0) {
  7.                 processReference = processReferences.remove(pid);
  8.             } else if (exitValue == WAIT_STATUS_NO_CHILDREN) {
  9.                 if (processReferences.isEmpty()) {
  10.                     /**
  11.                      * There are no eligible children; wait for one to be
  12.                      * added. The wait() will return due to the
  13.                      * notifyAll() call below.
  14.                      */
  15.                     try {
  16.                         processReferences.wait();
  17.                     } catch (InterruptedException ex) {
  18.                         // This should never happen.
  19.                         throw new AssertionError("unexpected interrupt");
  20.                     }
  21.                 } else {
  22.                     /**
  23.                      * A new child was spawned just before we entered
  24.                      * the synchronized block. We can just fall through
  25.                      * without doing anything special and land back in
  26.                      * the native wait().
  27.                      */
  28.                 }
  29.             } else {
  30.                 // Something weird is happening; abort!
  31.                 throw new AssertionError("unexpected wait() behavior");
  32.             }
  33.         }
  34.  
  35.         if (processReference != null) {
  36.             ProcessImpl process = processReference.get();
  37.             if (process != null) {
  38.                 process.setExitValue(exitValue);
  39.             }
  40.         }
  41.     }//源代码片段来自云代码http://yuncode.net
  42.                        

回复 " [Java] Process 创建+控制+分析"

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

captcha