This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Thread safe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Thread safe" Watch "Thread safe" New topic
Author

Thread safe

jaiser roney
Greenhorn

Joined: Jul 15, 2009
Posts: 16
Hi All,

How can we make a method thread-safe (but in terminology we are talking about classes as thread safe) by declaring it as static, i know about synchronized concept but is it possible to make thread safe with only static key word.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41045
    
  43
Declaring a method as static has no impact on its thread-safety (or thread-unsafety); that's determined by what the method does with data structures that represent shared state.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread safe
 
Similar Threads
Static variable
encapsulation
Threads
Thread Safety in Servlets
Mock Question about thread-safe