We have a scenario in which several threads call a static method like the following one:
public static boolean isEmpty(final String s) {
return s == null || s.length() < 1;
}
Could it cause a problem of inconsistence if 100 threads call it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. This wont suffer from any concurrency problems.
1) The parameter you pass in is a String which is an immutable class (its value cannot be modified)
2) The method doesn’t try to modify any shared state