Many years ago when I learned Java (in 2000) I was not so concerned about multithreading. In particular I wasn't concerned about the
volatile
modifier. I don't know why, but I never had problems without
volatile
, so maybe I thought it could not be so relevant. I've suddenly changed my mind when I first analyzed a wierd behaviour of an application that only existed when the application was deployed to a server JVM. Todays JVMs make a lot magic stuff to optimize runtime performance on server applications. In this blog I show you an example to get fimiliar with problems that arrize in multithreaded applications, when you don't recognize the importance of understanding how Java treats shared data in multithreaded programs.