This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
a method is thread safe is depends on how the method is access by two different thread.
if a single instance(object which has attachThisVal method) is shared by two thread, then the method is not thread safe . instance variable is shared by concurrent threads. <edit>
however, here StringBuffer is used as instance variable, StringBuffer methods are synchronized, so append is synchronized, hence threads are syncronized here.
The local variable is "value", but the StringBuffer is global to all threads calling that method. So while StringBuffer is thread-safe, the method "attachThisVal" isn't. For example, is posible an output like "Thread-1Thread-2Thread-3valuevaluevalue", if there is three threads and the value of parameter "value" is "value".