Yes, you're doing something wrong.
The problem is here:
Your code submits a task then waits for it to finish, which achieves nothing in parallel; the tasks run sequentially. And your
BlockingQueue adds no value whatsoever.
The way to run tasks in parallel is to first submit all tasks, collect the
Futures returned, then call
get() on all of them. Like this:
List<Future<Integer>> futures = filesInPath.stream()
.map(<create your Callable>)
for (Future future : futures)
totalWordCount += future.get();
You can actually do it in one stream, by going through the intermediate list (as above) but then immediately streaming that, but you have to wrap the call to
Future#get in some code to catch the checked exception - I leave that as an exercise for the reader.