java - ExecutorService shutdown -
i confused javadoc of executorservice#shutdown method. aren't these contradictory statements?
initiates orderly shutdown in submitted tasks executed, no new tasks accepted. method not wait submitted tasks complete execution. use awaittermination that.
if can orderly shutdown submitted tasks, how can't wait them complete execution?
it means method returns in thread call in, tasks haven't yet been executed might still running, in other threads.
if want program wait until tasks had been submitted have finished, have call awaittermination
after calling shutdown
.
Comments
Post a Comment