Shailesh Narkhede wrote:
If they are synchronized: since there's only one instance it also makes no difference, unless I'm missing something, since all threads are locking the same object regardless of whether it's an instance or static method.
No, Static synchronized method will lock class, it is a class level lock for static synchronized method. all object of that class is get locked for executing the static synchrized method.
Yes I know. If it's static synchronized, all threads will lock on the Class object. If it's a synchronized instance method, all threads will lock on the single instance of the servlet. Therefore the threads all lock on the same object
as each other, whether that is the class or the servlet.