If there's any threading issues with that code it's in the Message objects, which may or may not be shared (it depends on how the method is called). And the StringBuffer doesn't have any effect there.
The "Message" which is passed is just a bean object. There are diff "Message" instances would be passed to this utility function from so many areas(eq. Services, Class run by threads). My doubt here is if any service invokes this method during another works on it, is it any possible to return improper id due to concurrency? Here, synchronized can be used to avoid concurrency issue. But, feel like synchronized may be overloaded in this case if no possibility of concurrency issue @ any time. Please provide your valuable suggestions :-)
-Raj