# HG changeset patch # User mgronlun # Date 1569846464 -7200 # Node ID db26cf04e6abbac04d2f0f753bd03e1bf0140358 # Parent 58c7f9d726ba9bc76613b89b392a04dd48a3aa3e let TestLargeRootSet retry on failure diff -r 58c7f9d726ba -r db26cf04e6ab test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java --- a/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java Mon Sep 30 13:28:33 2019 +0200 +++ b/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java Mon Sep 30 14:27:44 2019 +0200 @@ -91,36 +91,37 @@ public static void main(String[] args) throws Exception { WhiteBox.setWriteAllObjectSamples(true); - - List threads = new ArrayList<>(); - try (Recording r = new Recording()) { - r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity"); - r.start(); - CyclicBarrier cb = new CyclicBarrier(THREAD_COUNT + 1); - for (int i = 0; i < THREAD_COUNT; i++) { - RootThread t = new RootThread(cb); - t.start(); - if (i % 10 == 0) { - // Give threads some breathing room before starting next batch - Thread.sleep(100); + while (true) { + List threads = new ArrayList<>(); + try (Recording r = new Recording()) { + r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity"); + r.start(); + CyclicBarrier cb = new CyclicBarrier(THREAD_COUNT + 1); + for (int i = 0; i < THREAD_COUNT; i++) { + RootThread t = new RootThread(cb); + t.start(); + if (i % 10 == 0) { + // Give threads some breathing room before starting next batch + Thread.sleep(100); + } + threads.add(t); } - threads.add(t); + cb.await(); + System.gc(); + r.stop(); + cb.await(); + List events = Events.fromRecording(r); + Events.hasEvents(events); + for (RecordedEvent e : events) { + RecordedObject ro = e.getValue("object"); + RecordedClass rc = ro.getValue("type"); + System.out.println(rc.getName()); + if (rc.getName().equals(StackObject[].class.getName())) { + return; // ok + } + } + // Asserts.fail("Could not find root object"); } - cb.await(); - System.gc(); - r.stop(); - cb.await(); - List events = Events.fromRecording(r); - Events.hasEvents(events); - for (RecordedEvent e : events) { - RecordedObject ro = e.getValue("object"); - RecordedClass rc = ro.getValue("type"); - System.out.println(rc.getName()); - if (rc.getName().equals(StackObject[].class.getName())) { - return; // ok - } - } - Asserts.fail("Could not find root object"); } } }