You are trying to lock an object. If you pass the same object, then your processing will be synchronized, which means that one thread will execute code inside the synchronized block, and the other thread will wait for it. But if you pass two different objects, then they will use two different locks, which means that they do not depend on each other to make the lock. Therefore, both of them will be executed in parallel.
How you wrote the code and trying to synchronize the execution using the source object. Therefore, make sure that both of your threads use the same source object to get the desired result.
source share