Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-329

Pointless synchronized in ThreadLocal.initialValue should be removed

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.4
    • Component/s: None
    • Labels:
      None
    • Environment:

      Any

      Description

      — jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java 2007/01/27 07:13:59 500497
      +++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringStyle.java 2007/04/20 05:06:03 530645
      @@ -103,7 +103,7 @@

      • </p>
        */
        private static ThreadLocal registry = new ThreadLocal() {
      • protected synchronized Object initialValue() {
        + protected Object initialValue() {
        // The HashSet implementation is not synchronized,
        // which is just what we need here.
        return new HashSet();

      — jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java 2006/09/19 21:58:11 447989
      +++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java 2007/04/20 05:11:46 530648
      @@ -103,7 +103,7 @@

      • @since 2.3
        */
        private static ThreadLocal registry = new ThreadLocal() {
      • protected synchronized Object initialValue() {
        + protected Object initialValue() {
        // The HashSet implementation is not synchronized,
        // which is just what we need here.
        return new HashSet();

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hchar Hanson Char
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: