equal
deleted
inserted
replaced
43 static class EndEvent extends Event { |
43 static class EndEvent extends Event { |
44 } |
44 } |
45 |
45 |
46 public static void main(String... args) throws Exception { |
46 public static void main(String... args) throws Exception { |
47 CountDownLatch end = new CountDownLatch(1); |
47 CountDownLatch end = new CountDownLatch(1); |
|
48 CountDownLatch firstFlush = new CountDownLatch(1); |
48 try (RecordingStream es = new RecordingStream()) { |
49 try (RecordingStream es = new RecordingStream()) { |
49 es.onEvent(EndEvent.class.getName(), e -> { |
50 es.onEvent(EndEvent.class.getName(), e -> { |
50 end.countDown(); |
51 end.countDown(); |
51 }); |
52 }); |
|
53 es.onFlush(() -> { |
|
54 firstFlush.countDown(); |
|
55 }); |
52 es.startAsync(); |
56 es.startAsync(); |
|
57 System.out.println("Invoked startAsync()"); |
|
58 // Wait for stream thread to start |
|
59 firstFlush.await(); |
|
60 System.out.println("Stream thread active"); |
53 Recording r1 = new Recording(); |
61 Recording r1 = new Recording(); |
54 r1.start(); |
62 r1.start(); |
55 System.out.println("Chunk 1 started"); |
63 System.out.println("Chunk 1 started"); |
56 Recording r2 = new Recording(); |
64 Recording r2 = new Recording(); |
57 r2.start(); |
65 r2.start(); |