Hi Martin Thanks for the review, I will try to address your review comment.
I wanted to write a simple test case for this issue but it is getting more complex. Thanks, Vyom On Sat, Jul 4, 2020 at 8:14 PM Martin Buchholz <marti...@google.com> wrote: > On Fri, Jul 3, 2020 at 11:12 PM Alan Bateman <alan.bate...@oracle.com> > wrote: > > > - "service" isn't a great name for the Executor. Also you can make use > > of try-finally, e.g. > > ExecutorService executor = Executors.newFixedThreadPool(1); > > try { ... } finally { executor.shutdown(); } > > If you want to do this structured-concurrency-style, you should wait > for all the threads you started to complete (they might block!). > shutdown is not enough - you also want awaitTermination. > > We have a PoolCleaner utility in test/jdk/java/util/concurrent/tck/ to > help do this. > > try (PoolCleaner cleaner = cleaner(p)) { > -- Thanks, Vyom