Skip to content

Tag: synchronized

Java Synchronized on the same file, but not different

I have this static class: that have lots of methods and this one above is one of these. what I would like to do is that if two callers write to the same file, the writing should be done in mutual exclusion. But when callers write to different files, this doesn’t happen (they don’t write in mutual …

Java async MySQL queries

First of all, I don’t have much experience with thread safe programming. I have a MySQL class, and I want to use one instance in multiple threads to prevent blocking code in the main thread. I read about connection pooling but I want to keep it as simple as it is. This is my MySQL class: Is it possible …