Should a lock that works at object level reamin working once its scope is made static ?
If you move a lock from being an instance lock to be a static lock, it should not cause concurrency issues. You are correct that it should make the code more restrictive in that a single lock will be used instead of multiple instance locks. This is, of course, if the lock in question is static final
and all of the places in your code are appropriately locking it.
public static final Object lockObject = new Object();
What may be happening is that moving the lock has uncovered a bug that was there previously but application timing was causing it to be hidden. By locking on a static
lock (or on a static
method) the timing of the threads in your application will most likely be significantly changed.
If you post more details about the code or the errors that you are getting, we can provide better answers.