This method spawns a jar, and waits for it to exit [either cleanly or forcibly]

@param interval
How often should the application check if the command is still running or if it exit.
@throws IOException
@throws InterruptedException
186164
final void continuouslyRestart(long interval) throws IOException, InterruptedException {
        LOGGER.entering(interval);

        while (true) {
            if (!isInitialized()) {
                FileDownloader.checkForDownloads(getType(), getLauncherOptions()
                        .isFileDownloadCheckTimeStampOnInvocation(), getLauncherOptions()
                        .isFileDownloadCleanupOnInvocation());
            }

            startProcess(false);

            while (!handler.hasResult()) {
                LOGGER.fine("Child process still running. Going back to sleep.");
                Thread.sleep(interval);
            }

            if (handler.hasResult()) {
                ExecuteException e = handler.getException();
                if (e != null) {
                    LOGGER.log(Level.SEVERE, handler.getException().getMessage(), handler.getException());
                }
            }
            LOGGER.info("Child process quit. Restarting it.");
            setInitialized(false);
        }
    }
29621
public void setInterval(ReadableInterval interval) {
        if (interval == null) {
            throw new IllegalArgumentException("Interval must not be null");
        }
        long startMillis = interval.getStartMillis();
        long endMillis = interval.getEndMillis();
        Chronology chrono = interval.getChronology();
        super.setInterval(startMillis, endMillis, chrono);
    }
918634
public NotifyingFuture<V> poll(long timeout, TimeUnit unit) throws InterruptedException {
        return completionQueue.poll(timeout, unit);
    }
640502
synchronized void resume() {
        paused = false;
        if (activeTask == null) {
            activeTask = new IntervalTask(this);
            timer.schedule(activeTask, interval, interval);
        }
    }
1178519
private int externalInterruptibleAwaitDone() throws InterruptedException {
        int s;
        if (Thread.interrupted())
            throw new InterruptedException();
        while ((s = status) >= 0) {
            if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
                synchronized (this) {
                    if (status >= 0)
                        wait();
                    else
                        notifyAll();
                }
            }
        }
        return s;
    }
1363573
@Override
    public void onOnline(Computer c, TaskListener listener) throws IOException, InterruptedException {
        synchronized(this) {
            future.cancel(false);
            future = Timer.get().schedule(MONITOR_UPDATER, 5, TimeUnit.SECONDS);
        }
    }
570605
public void waitUntilConnectionReleasedIfNecessary() throws InterruptedException {
        if (ConnectionStatus.RUNNING == status.get() || ConnectionStatus.TERMINATED == status.get()) {
            while (!status.compareAndSet(ConnectionStatus.RELEASE, ConnectionStatus.RUNNING)) {
                resourceSynchronizer.doAwaitUntil();
            }
        }
    }
49030
@Override
    public void ioErrorCeased(IoErrorCeasedEvent event) throws InterruptedException {
        String message = "I/O error ceased when polling directory '%s'!";
        PolledDirectory dir = event.getPolledDirectory();
        LOG.info(String.format(message, dir));
    }
703761
@FFDCIgnore({ InterruptedException.class })
    public synchronized void waitForLevel() {
        // Don't bother waiting if the vm has been shutdown in the meanwhile...
        while (levelReached.get() == false && !shutdownHook.vmShutdown()) {
            try {
                // waiting for a start level event should not take long
                wait(1000);
            } catch (InterruptedException e) {
                /** No-op **/
            }
        }
    }
611593
public void fadeOut (float interval, boolean dispose)
    {
        _fadeMode = dispose ? FadeMode.OUT_DISPOSE : FadeMode.OUT;
        _fadeInterval = interval;
        _fadeElapsed = 0f;
    }
185204
public void interrupt() {
        Queue.withLock(new Runnable() {
            @Override
            public void run() {
                for (Executor e : executors) {
                    e.interruptForShutdown();
                }
            }
        });
    }
414236
public void startDaemon(final long interval) {
        if (daemon != null) {
            throw new RuntimeException("Trying to start daemon while it is still running");
        }
        stopDaemon = false;
        daemon = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    while (!stopDaemon) {
                        try {
                            Collection<CompilationUnit> units = execute();
                            if (!units.isEmpty() && compilationListener != null) {
                                compilationListener.notifySuccessfulCompilation(units);
                            }
                        } catch (LessParseException e) {
                            System.out.println(e.getMessage());
                        }
                        Thread.sleep(interval);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                daemon = null;
            }
        }, "LessCompilationDaemon");
        daemon.setDaemon(true);
        daemon.start();
    }
1340210
public static int waitForExitProcess(Pointer hProcess) throws InterruptedException {
        while (true) {
            if (Thread.interrupted())
                throw new InterruptedException();

            Kernel32.INSTANCE.WaitForSingleObject(hProcess,1000);
            IntByReference exitCode = new IntByReference();
            exitCode.setValue(-1);
            Kernel32.INSTANCE.GetExitCodeProcess(hProcess,exitCode);

            int v = exitCode.getValue();
            if (v !=Kernel32.STILL_ACTIVE) {
                return v;
            }
        }
    }
537201
public void run(Context context) throws IOException, InterruptedException {
    setup(context);
    while (context.nextKey()) {
      context.progress();
      reduce(context.getCurrentKey(), context.getValues(), context);
    }
    cleanup(context);
  }
1153008
protected static void waitForDataDelivery(int waitTimeSecs) throws InterruptedException {
        LOG.info("Since the Buffering Hints IntervalInSeconds parameter is specified as: " + waitTimeSecs
                + " seconds. Waiting for " + waitTimeSecs + " seconds for the data to be written to S3 bucket");
        TimeUnit.SECONDS.sleep(waitTimeSecs);

        LOG.info("Data delivery to S3 bucket " + s3BucketName + " is complete");
    }
596971
private void interruptGracefully() throws IOException {
    LOG.info("Attempting graceful interruption of job " + this.jobContext.getJobId());

    this.fs.createNewFile(this.interruptPath);

    long waitTimeStart = System.currentTimeMillis();
    while (!this.job.isComplete() && System.currentTimeMillis() < waitTimeStart + 30 * 1000) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException ie) {
        break;
      }
    }

    if (!this.job.isComplete()) {
      LOG.info("Interrupted job did not shut itself down after timeout. Killing job.");
      this.job.killJob();
    }
  }
1314694
private synchronized void waitForCommands(final ActiveContext context) {
    while (!scheduler.hasPendingTasks()) {
      // Wait until any command enters in the queue
      try {
        wait();
      } catch (final InterruptedException e) {
        LOG.log(Level.WARNING, "InterruptedException occurred in SchedulerDriver", e);
      }
    }
    // When wakes up, run the first command from the queue.
    state = State.RUNNING;
    scheduler.submitTask(context);
  }