I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
If that's the reasoning behind it, I still disagree. The fact that multiple threads won't corrupt the StringBuffer's internal data structures doesn't make storing it in a static variable threadsafe. When writing code working with the buffer, you will have to be constantly on the guard for threading issues. I wouldn't want to call the "value" variable threadsafe in any meaningful sense of the word.Originally posted by Michael Fritz:
I think the trick here is that value is a StringBuffer object. [...] "String buffers are safe for use by multiple threads. [...]"
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Originally posted by Peter den Haan:
When writing code working with the buffer, you will have to be constantly on the guard for threading issues. I wouldn't want to call the "value" variable threadsafe in any meaningful sense of the word.
- Peter
Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Dare To Dream<br />SCJP2<br />SCWCD<br />CCNA<br />ORACLE 8i(Exam 1Z0-001)
Consider Paul's rocket mass heater. |