As per the
thread is concerned there is no guarantee that some set of threads will run in a particular manner.
Lets say I have three different threads for an stock application.
Thread one=new thread(nr); \\This thread will download the stock price
Thread two =new Thread(nr); \\This thread will update the stock into database table
Thread three =new Thread(nr); \\This thread will show the stock price from the database to the stock application's local users.
Now when I run this application in my JVM it can behave in sequence i.e first thread one will run and then Thread two and finally Thread three.
But this behavior is not guaranteed.So if any other JVM runs the same piece of code in that case it may not run in the same sequence.But that is not required.I want whateverr JVM we run this code it should run in the same sequence as it ran in my JVM (i.e First Thread one will run and then Thread two and finally Thread three.)
My question is how can I make sure of the running sequences of these threads with respect to any JVM. And the sequence is very important as the threads are depending on each other.(Will join() method will do this)
Apart from JOIN() method how can we guarantee the same.
Thanks.