Let's say I have a database, and I load all the instances from the database to memory when the server starts. All these instances are stored in a hashmap (String, Object). How do I remove a specific set of the instances and erase it from database? Right now, I have a synchronised method that does it (loops through the hashmap, and checks if the object should be removed). But now, when the server has a lot more players, and everybody is constantly causing the hashmap to be used, the synchronised method can take forever to complete. Is there a better way for this?