Will the lock be removed if we delete the object which monitor is being used
Let’s imagine that we have some kind of public global map which entities’ monitors are used in synchronized blocks in different methods of other classes. In some moment we remove entities from our collection and garbage collector removes it from application memory.
Sample code is below:
Will the lock be removed if we delete the object which monitor is being used
Let’s imagine that we have some kind of public global map which entities’ monitors are used in synchronized blocks in different methods of other classes. In some moment we remove entities from our collection and garbage collector removes it from application memory.
Sample code is below: