I would add that even if you do plan of having your StringThingy accessed by multiple concurrent threads, the method-level synchronization StringBuffer gies you is very often
not sufficient. More often than not, you want to synchronize across more than one call. E.g.
Having each append() call synchronized is not really enough to make sure you get meaningful log messages that do not mix information from two different threads. This should probably be replaced with:
If you need synchronization, more often than not
you should put it in yourself, at the correct level. Don't rely on some supposedly "thread-safe" class like StringBuilder, Vector, or Hashtable to do it for you. Often they're not what you need anyway, and they breed false confidence in developers trying to make their code thread-safe.
[ February 13, 2005: Message edited by: Jim Yingst ]