Limiting concurrent access to a method
问题 I have a problem with limiting concurrent access to a method. I have a method MyService that can be called from many places at many times. This method must return a String , that should be updated according to some rules. For this, I have an updatedString class. Before getting the String , it makes sure that the String is updated, if not, it updates it. Many threads could read the String at the same time but ONLY ONE should renew the String at the same time if it is out of date. public final