for (Threadthread : threads) thread.interrupt(); for (Threadthread : threads) { thread.join(10_000); if (thread.isAlive()) {
dumpAllStacks(); thrownew Error("At least one child thread ("
+ thread.getName()
+ ") failed to finish gracefully");
}
}
}
staticclass OpenLoop implements Runnable { publicvoid run() {
threadsStarted.countDown(); while (!Thread.interrupted()) { try { // wait for ExecLoop to finish creating process do { if (Thread.interrupted()) return;
} while (count(procFDsInUse()) != 3);
List<InputStream> iss = new ArrayList<>(4);
// eat up three "holes" (closed ends of pipe fd pairs) for (int i = 0; i < 3; i++)
iss.add(new FileInputStream(BIG_FILE)); do { if (Thread.interrupted()) return;
} while (count(procFDsInUse()) == procFDs.length); // hopefully this will racily occupy empty fd slot
iss.add(new FileInputStream(BIG_FILE)); Thread.sleep(1); // Widen race window for (InputStream is : iss)
is.close();
} catch (InterruptedException e) { break;
} catch (Exception e) { thrownew Error(e);
}
}
}
}
staticclass ExecLoop implements Runnable { publicvoid run() {
threadsStarted.countDown();
ProcessBuilder builder = new ProcessBuilder("/bin/true"); while (!Thread.interrupted()) { try { // wait for OpenLoop to finish do { if (Thread.interrupted()) return;
} while (count(procFDsInUse()) > 0);
Process process = builder.start();
InputStream is = process.getInputStream();
process.waitFor();
is.close();
} catch (InterruptedException e) { break;
} catch (Exception e) { thrownew Error(e);
}
}
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.