/** *WaitsforandreturnsthedirectexpectedChildrenofaProcessHandle. *ForWindows,theconhost.exechildrenarefilteredout. * *@paramphtheprocesstogetthechildrenof *@paramnchildrentheminimumnumberofchildrentoexpect *@returnalistofProcessHandlesofthechildren.
*/ publicstatic List<ProcessHandle> waitForChildren(ProcessHandle ph, long nchildren) {
List<ProcessHandle> subprocesses = null; long count = 0; do { if (subprocesses != null) { // Only wait if this is not the first time looking try { Thread.sleep(500L); // It will happen but don't burn the cpu
} catch (InterruptedException ie) { // ignore
}
}
subprocesses = getChildren(ph);
count = subprocesses.size();
System.out.printf(" waiting for subprocesses of %s to start," + " expected: %d, current: %d%n", ph, nchildren, count);
} while (count < nchildren); return subprocesses;
}
/** *WaitsforandreturnsallexpectedChildrenofaProcessHandle. *ForWindows,theconhost.exechildrenarefilteredout. * *@paramphtheprocesstogetthechildrenof *@paramnchildrentheminimumnumberofchildrentoexpect *@returnalistofProcessHandlesofthechildren.
*/ publicstatic List<ProcessHandle> waitForAllChildren(ProcessHandle ph, long nchildren) {
List<ProcessHandle> subprocesses = null; long count = 0; do { if (subprocesses != null) { // Only wait if this is not the first time looking try { Thread.sleep(500L); // It will happen but don't burn the cpu
} catch (InterruptedException ie) { // ignore
}
}
subprocesses = getDescendants(ph);
count = subprocesses.size();
System.out.printf(" waiting for subprocesses of %s to start," + " expected: %d, current: %d%n", ph, nchildren, count);
} while (count < nchildren); return subprocesses;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.