albertfc / csv

MIT License
0 stars 0 forks source link

Executor shutdown #1

Open pditommaso opened 5 months ago

pditommaso commented 5 months ago

Thanks for creating this project. I was looking at the executor shutdown and I was wondering why it was used shutdownNow instead of shutdown. Is there a specific reason?

https://github.com/albertfc/csv/blob/dc4f4908744341622c0cb2e4b4272b4589801d63/src/main/java/com/seqera/ParallelDataProcessor.java#L22-L22

albertfc commented 5 months ago

As far I understand, the main difference between shutdown and shutdownNow is that the later tries to cancel all the currently active tasks. Calling one or the other depends on the semantics we want to give to the close method. IMO both can be valid.

pditommaso commented 5 months ago

Yep, tho shutdownNow can be disruptive because it will try to cancel running tasks. For an orderly shutdown it may be preferable using shutdown() followed by awaitTermination()