Skip to content

Tag: thread-safety

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 …

Why are local variables thread safe in Java

I was reading multi-threading in Java and I come across this Local variables are thread safe in Java. Since then I have been thinking How/Why local variables are thread safe. Can somebody please let me know. Answer When you create a thread it will have its own call stack created. Two threads will have two sta…