The allDrugs map is static but the methods of DrugController are not. Making its methods synchronised still allows simultaneous access to the allDrugs via 2 different DrugController objects. Either the methods should be static too or or synchronized(DrugController.class) should be used.