I have two methods in a java class that both have a block of code that synchronize using the same object. I understand that in the JAVA synchronization scheme locks acquired ...
I can see how that's confusing. The problem isn't with calling other objects' methods within your synchronized block or method; it's really just that you should do as little as you need to do within your block or method so that any objects in other threads can access those same resources quickly. In the example given in the tutorial, there may ...
synchronized(lock1){ c++; } does this mean that no other thread can access the part of the method that increments c if another thread is currently using that part of the method? or does it mean that no other thread can use the lock1 object? And what would happen if instead of lock1 i would have the this keyword, would that mean ...
I haven't got a copy of it and it is hard to simulate it (the application can run for days without a problem). It starts from a third thread that can also push something in the queue (at any time there can be multiple threads that can push object in the queue and there is one thread responsible for emtying the ...