equal
deleted
inserted
replaced
61 } |
61 } |
62 |
62 |
63 public static void main(String... args) throws Exception { |
63 public static void main(String... args) throws Exception { |
64 testEventStream(); |
64 testEventStream(); |
65 testRecordingStream(); |
65 testRecordingStream(); |
|
66 testEmptyStream(); |
|
67 } |
|
68 |
|
69 private static void testEmptyStream() { |
|
70 try (RecordingStream rs = new RecordingStream()) { |
|
71 rs.setEndTime(Instant.now().plusMillis(1100)); |
|
72 rs.start(); |
|
73 } |
66 } |
74 } |
67 |
75 |
68 private static void testRecordingStream() throws Exception { |
76 private static void testRecordingStream() throws Exception { |
69 while (true) { |
77 while (true) { |
70 CountDownLatch closed = new CountDownLatch(1); |
78 CountDownLatch closed = new CountDownLatch(1); |
87 m.commit(); |
95 m.commit(); |
88 Thread.sleep(10); |
96 Thread.sleep(10); |
89 } |
97 } |
90 closed.await(); |
98 closed.await(); |
91 System.out.println("Found events: " + count.get()); |
99 System.out.println("Found events: " + count.get()); |
92 if (count.get() < 50) { |
100 if (count.get() > 0 && count.get() < 50) { |
93 return; |
101 return; |
94 } |
102 } |
95 System.out.println("Found 50 events. Retrying"); |
103 System.out.println("Retrying"); |
96 System.out.println(); |
104 System.out.println(); |
97 } |
105 } |
98 } |
106 } |
99 } |
107 } |
100 |
108 |