File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class DelayedTask implements Runnable, Delayed {
1313 private final int delta ;
1414 private final long trigger ;
1515 protected static List <DelayedTask > sequence =
16- new CopyOnWriteArrayList <>();
16+ new ArrayList <>();
1717 public DelayedTask (int delayInMilliseconds ) {
1818 delta = delayInMilliseconds ;
1919 trigger = System .nanoTime () +
@@ -49,7 +49,7 @@ public static class EndTask extends DelayedTask {
4949 @ Override
5050 public void run () {
5151 sequence .forEach (dt ->
52- System .out .println (dt .summary () + " " ));
52+ System .out .println (dt .summary ()));
5353 }
5454 }
5555}
@@ -58,8 +58,7 @@ public class DelayQueueDemo {
5858 public static void
5959 main (String [] args ) throws Exception {
6060 DelayQueue <DelayedTask > tasks =
61- Stream .concat (
62- // Tasks with random delays:
61+ Stream .concat ( // Random delays:
6362 new Random (47 ).ints (20 , 0 , 4000 )
6463 .mapToObj (DelayedTask ::new ),
6564 // Add the summarizing task:
You can’t perform that action at this time.
0 commit comments