Wait for a given process.

@param process the process one wants to wait for.
489344
@Nullable
    private Integer waitFor(Process process) {
        try {
            return process.waitFor();
        } catch (InterruptedException e) {
            log.info("interrupted in Process.waitFor");
            return null;
        }
    }
735674
public void execute(org.parallelj.mirror.Process process) {

		if (!(process instanceof KProcess)) {
			return;
		}
		this.execute((KProcess) process);
	}
257822
@Override public void stop() {
        lock.lock();
        try {
            if (process != null) {
                destroyProcess();
            }
            process = null;
        } finally {
            lock.unlock();
        }
    }
1234942
@Override
	public void run() {

		while (!stopProcessing.get()) {

			try {
				JawrWatchEvent evt = watchEvents.take();
				AtomicBoolean processingBundle = bundlesHandler.isProcessingBundle();
				synchronized (processingBundle) {

					// Wait until processing ends
					while (processingBundle.get() && !stopProcessing.get()) {
						try {
							processingBundle.wait();
						} catch (InterruptedException e) {
							LOGGER.debug("Thread interrupted");
						}
					}
				}
				if (evt != null && !stopProcessing.get()) {
					process(evt);
				}
			} catch (InterruptedException e) {
				LOGGER.debug("Thread interrupted");
			}
		}
		
		this.bundlesHandler = null;
		this.watcher = null;
	}
148681
public void waitForCompletion() throws InterruptedException {
        try {
            waitForCompletion(0L);
        } catch (AsyncTimeoutException ate) {
            // cannot happen since arg of 0L means wait forever
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unexpected timeout on blocking wait call, exception: " + ate.getMessage());
            }
            FFDCFilter.processException(ate,
                                        getClass().getName() + ".waitForCompletion", "268", this);
            InterruptedException ie = new InterruptedException("Unexpected timeout");
            ie.initCause(ate);
            throw ie;
        }
    }
1201034
public static void wait(Object lock, long timeout) {
	try {
	    synchronized (lock) {
		lock.wait(timeout);
	    }
	}
	catch (InterruptedException e) {}
    }
127735
public void waitForBuffer(long timeoutMilli) {
        //assert(callerProcessing.booleanValue() == false);

        synchronized(buffer) {
            if( dirtyBuffer )
                return;
            if( !foundEOF() ) {
                logger.trace("Waiting for things to come in, or until timeout");
                try {
                    if( timeoutMilli > 0 )
                        buffer.wait(timeoutMilli);
                    else
                        buffer.wait();
                } catch(InterruptedException ie) {
                    logger.trace("Woken up, while waiting for buffer");
                }
                // this might went early, but running the processing again isn't a big deal
                logger.trace("Waited");
            }
        }
    }
1276672
public static synchronized void setProcess(String applicationName, String scopedInstancePath, Process process) {
		PROCESS_MAP.put(toAgentId(applicationName, scopedInstancePath), process);
	}
145859
public void waitUntilFinish() {
        while (!finished) {
            synchronized (waitingLock) {
                if (config.isHaltOnError()) {
                    Throwable t = getError();
                    if (t != null && config.isHaltOnError()) {
                        if (t instanceof RuntimeException) {
                            throw (RuntimeException)t;
                        } else if (t instanceof Error) {
                            throw (Error)t;
                        } else {
                            throw new RuntimeException("error on monitor thread", t);
                        }
                    }
                }
                if (finished) {
                    return;
                }
                try {
                    waitingLock.wait();
                } catch (InterruptedException e) {
                    logger.error("Error occurred", e);
                }
            }
        }
    }
1358144
public ContainerWait wait(String containerId) {
		ContainerWait command = new ContainerWait();
		command.container(containerId);
		action.setCommand(command);
		return command;
	}
1239616
async def wait_for_all_to_process(self, *matchers, eventlist = None, eventdict = None,
                                            callback = None):
        
        def _callback(event, matcher):
            event.canignore = True
            if callback:
                callback(event, matcher)
        return await self.wait_for_all(*matchers, eventlist=eventlist,
                                       eventdict=eventdict, callback=_callback)
723127
def wait(self) -> None:
        """"""
        if self._out_thread.is_alive():
            self._out_thread.join()
        if self._err_thread.is_alive():
            self._err_thread.join()

        # Handle case where the process ended before the last read could be done.
        # This will return None for the streams that weren't pipes.
        out, err = self._proc.communicate()

        if out:
            self._write_bytes(self._stdout, out)
        if err:
            self._write_bytes(self._stderr, err)
677183
public static int procWait (Process process) throws OSHelperException {
		try {
			return process.waitFor ();
		} catch (InterruptedException ex) {
			throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex);
		}
	}
596298
void waitForReady() {
    if (!ready) {
      writeLock();
      try {
        while (!ready) {
          try {
            cond.await(5000, TimeUnit.MILLISECONDS);
          } catch (InterruptedException ie) {
          }
        }
      } finally {
        writeUnlock();
      }
    }
  }
729128
private static void waiting(int milliseconds) {
        long t0, t1;
        t0 = System.currentTimeMillis();
        do {
            t1 = System.currentTimeMillis();
        } while ((t1 - t0) < milliseconds);
    }
1291105
public boolean execute(ProcessInstance processInstance) {
		log.debug("{}",this);
		ProcessInstanceUtils.setQueue(processInstance, getOwnerProcess().getWorkflowManager().getQueue(m_queue));
		return false;
	}
458678
public void await(Event event, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException {
        long timestamp = getTimestamp(event);
        try {
            lock.lockInterruptibly();
            single(timestamp);
            while (isPermit(event, timestamp) == false) {
                condition.await(timeout, unit);
            }
        } finally {
            lock.unlock();
        }
    }