示例#1
0
 private void tryConnect() throws RpcException {
   synchronized (connectLock) {
     switch (state) {
       case DISCONNECTED:
         reported = false;
         if (connectRetry()) {
           state = State.CONNECTED;
         } else if (connectOnce) {
           state = State.DOWN;
         } else {
           state = State.DISCONNECTED;
         }
         break;
       case CONNECTED:
         break;
       case DOWN:
         try {
           if (process != null) {
             process.terminate();
           }
         } catch (final DebugException e) {
           ErlLogger.info(e);
         }
         // TODO restart it??
         // process =
         if (!stopped) {
           final String msg = reportRuntimeDown(data.getNodeName());
           throw new RpcException(msg);
         }
     }
   }
 }
 /* (non-Javadoc)
  * @see java.lang.Thread#run()
  */
 public IStatus run(IProgressMonitor mon) {
   try {
     // There is no join on a process available, so we will have to
     // busy wait. Give it 10 seconds in 1/10 second intervals.
     for (int i = 0; !process.isTerminated() && i < 100; i++) {
       try {
         Thread.sleep(100);
       } catch (InterruptedException e) {
       }
     }
     if (!process.isTerminated()) {
       process.terminate();
     }
   } catch (DebugException e) {
   }
   return Status.OK_STATUS;
 }
示例#3
0
 public void stopPVS() {
   if (iprocess != null) {
     if (iprocess.canTerminate()) {
       try {
         iprocess.terminate();
         iprocess = null;
         process = null;
         for (PVSStateChangeListener l : stateListeners) {
           l.sourceChanged(PVSConstants.PVSRUNNING, PVSConstants.FALSE);
         }
         DebugPlugin.getDefault().removeDebugEventListener(instance);
       } catch (DebugException e) {
         e.printStackTrace();
       }
     }
   }
   mode = PVSMode.OFF;
 }
 private void terminateForked() {
   if (killPorts != null) {
     for (int killPort : killPorts) {
       try {
         URI killUrl = new URI("http://localhost:" + killPort);
         HttpUtil.ping(killUrl);
       } catch (Throwable e) {
       }
     }
   }
   if (processes != null && processes.length > 1) {
     // Make sure all processes are terminated
     for (IProcess process : processes) {
       try {
         if (process.canTerminate() && !process.isTerminated()) {
           process.terminate();
         }
       } catch (Throwable e) {
         GrailsCoreActivator.log(e);
       }
     }
     processes = null;
   }
 }