publicstaticvoid main(String... args) throws Exception {
MBeanServerConnection conn = ManagementFactory.getPlatformMBeanServer();
Path dir = Files.createDirectories(Paths.get("max-size-" + System.currentTimeMillis()));
System.out.println(dir);
AtomicBoolean finished = new AtomicBoolean(); try (RemoteRecordingStream e = new RemoteRecordingStream(conn, dir)) {
e.startAsync();
e.onEvent(ev -> { if (finished.get()) { return;
} // Consume some events, but give back control // to stream so it can be closed. try { Thread.sleep(10);
} catch (InterruptedException e1) { // ignore
}
}); while (directorySize(dir) < 50_000_000) {
emitEvents(500_000);
}
System.out.println("Before setMaxSize(1_000_000)");
fileCount(dir);
e.setMaxSize(1_000_000);
System.out.println("After setMaxSize(1_000_000)"); long count = fileCount(dir); if (count > 3) { // Three files can happen when: // File 1: Header of new chunk is written to disk // File 2: Previous chunk is not yet finalized and added to list of DiskChunks // File 3: Previous previous file is in the list of DiskChunks. thrownew Exception("Expected at most three chunks with setMaxSize(1_000_000). Found " + count);
}
finished.set(true);
}
}
privatestaticvoid emitEvents(int count) throws InterruptedException { for (int i = 0; i < count; i++) {
Monkey m = new Monkey();
m.commit();
}
System.out.println("Emitted " + count + " events"); Thread.sleep(1000);
}
¤ 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.0.10Bemerkung:
(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.