class Clstest{
public static String testStaticMethod(String inFileStr) {
// section 0
// section 1
// do something with inFileStr
// section 2
// section 3
return inFileStr;
}
}
Let's assume there are five threads are each executing a call to Clstest.testStaticMethod("arg-n")
at the same time.
Thread 1 calls Clstest.testStaticMethod("arg-1")
.
When thread 1 is in the section 1, thread 2 calls Clstest.testStaticMethod("arg-2")
.
Then what will happen to Thread 1? Will it go to sleep state?
When Thread 1 got the chance will it resume the execution from section 1 where it was paused?
How it happens when there's one Clstest.testStaticMethod
and same Clstest.testStaticMethod
is shared between all five threads?
Is there any possibility to interchange the inFileStr
sent by multiple threads?