If I have a static method that only uses internal variables or variables that came as parameters on the function call, this function is thread safe? I mean, these internal function values are stored in the calling thread's stack or other place?
Imagine this (useless) method:
and the calling thread's run() method:
Thanks in advance for any reply!
<b><i>Bengt Hammarlund</i><br />� Sun Certified Java Programmer</b>
Yes, as long as you're not using any resources that might be shared by two threads - static member variables, other objects - you should be fine. I prefer not to talk about things like "stack space" but the idea that parameters and local variables in a method are in their own private space and scope is right & good.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi