Thanks for your answers.
Putting in a Thread.sleep() resolves the issues.
But surely this cannot be the correct way to use the ExecutorService
shutdown()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
My explanation is that the main
thread calls the getCount Method before all threads have run.
With
the code works as expected: always returning 1000;
That leaves the question how well the author of this video course researched the topics he presents.