The requirements didn't say about this, but i changed these three variables to volatile: - static DrugController drugController (in Solution class) - static boolean isStopped (in Solution class) - static Map<Drug, Integer> allDrugs (in DrugController class). My solution was accepted with these changes. But, I don't know, were these changes necessary? Maybe the task would have passed by validation without these changes too - I can't know it. But my thought process was that these three variables are used by all the threads, and so it's better to change them to volatile.