sahana mithra wrote:If thread A tries to access the file till it completes the reading and writing part, other threads must wait.
Well, all you need to do is write a method which does file reading-writing, and then call that logic from a synchronized block. That's it (of course, provided you synchronized it on proper object).
As of now, I've not completely understood your code (which is slightly difficult due to creating 3 useless threads and further killing those references inside another method - which creates and starts another (three) threads).
Not only this, what you are doing is - starting a thread, and passing that object to a method. Inside that method, you are simply killing that reference by assigning a new object to it. Can you please clarify which design choices were made here? And why?
Further to this (these things don't affect code logic directly though), your class name sounds more like a method name than class name (how about MultiThreadedFileReader etc?). Also, why that class is inside singleton package? It's not a singleton class (so far).
I hope this helps.