How to create file lock in java?

When multiple threads work on a shared resource its quiet possible that one thread’s work is over written by another one if the shared resource is modified without a mutually exclusive lock. This can be solved by moving the code responsible for the state change of the shared resource into a synchronized method/block. What if [...]
Continue reading…