Example:
ThisClass.staticMethod(Object... parameters);
will be accessed by multiple instances of other objects and simultaneously.
Will there be any dependencies with this other objects when they are using the same static method at the same time?
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.
Only if the method uses static Objects or the arguments are shared by the other instances.
Example: Math.max(int a, int b) is a static method but does not use any static objects, so there are no dependencies.
Example 2: Here all invocations share the same result variable, two parallel calls to staticMethod can cause wrong results.
Example 3: This one is Thread safe if none of the arguments are shared, each invocation has its own instance of result.
Example 4: This uses the class as a lock to prevent parallel access to the class functions. Only one call to staticMethod executes all others wait