JDK-6481181 : (str) Excess Synchronisation: Replace StringBuffer by StringBuilder when possible
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 5.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-10-12
  • Updated: 2017-07-20
  • Resolved: 2017-07-20
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
Since Java 5.0, StringBuilder has been introduced.
This is a great performance enhancement in server application.

A lot of java.* et javax.* still use old synchronized StringBuffer with no need as
java.net.URLDecoder.decode(String, String) for exemple.

It just can be simply replaced by StringBuilder instead.


JUSTIFICATION :
Synchronisation is costly, especially in high load multithreaded application wich are developped to limit synchronisation cost.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Replace StringBuffer by StringBuilder in the Java APIs where no synchronisation is needed.