test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java
branchJEP-349-branch
changeset 58771 e6feb2874fa6
parent 58770 481870c3d258
child 58862 abeb87af766e
equal deleted inserted replaced
58770:481870c3d258 58771:e6feb2874fa6
    58     public final static class Mark extends Event {
    58     public final static class Mark extends Event {
    59         public boolean before;
    59         public boolean before;
    60     }
    60     }
    61 
    61 
    62     public static void main(String... args) throws Exception {
    62     public static void main(String... args) throws Exception {
    63      //   testEventStream();
    63         testEventStream();
    64         testRecordingStream();
    64         testRecordingStream();
    65     }
    65     }
    66 
    66 
    67     private static void testRecordingStream() throws Exception {
    67     private static void testRecordingStream() throws Exception {
    68         while (true) {
    68         while (true) {
    75                 });
    75                 });
    76                 // when end is reached stream is closed
    76                 // when end is reached stream is closed
    77                 rs.onClose(() -> {
    77                 rs.onClose(() -> {
    78                     closed.countDown();
    78                     closed.countDown();
    79                 });
    79                 });
    80                 Instant endTime = Instant.now().plus(Duration.ofMillis(10_000));
    80                 Instant endTime = Instant.now().plus(Duration.ofMillis(100));
    81                 System.out.println("Setting end time: " + endTime);
    81                 System.out.println("Setting end time: " + endTime);
    82                 rs.setEndTime(endTime);
    82                 rs.setEndTime(endTime);
    83                 rs.startAsync();
    83                 rs.startAsync();
    84                 for (int i = 0; i < 50; i++) {
    84                 for (int i = 0; i < 50; i++) {
    85                     Mark m = new Mark();
    85                     Mark m = new Mark();