Answer the question
In order to leave comments, you need to log in
Different methods per thread or synchronized?
Let's say my program uses only 2-3 threads. There is a method marked synchronized. The question is, does it make sense to implement separate methods for each thread if there are few of them, or is it not accepted and has its own pitfalls, and is it better to use synchronized in one place?
Answer the question
In order to leave comments, you need to log in
I seem to have asked a very stupid question and only now I realized that it is stupid, because using a shared resource in different methods does not exempt from the need to use synchronized, and if there is no shared resource, then synchronized is not needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question