Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6184975

(thread spec) Clarify specification for ThreadLocal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • core-libs
    • b14
    • generic
    • generic

      Josh Bloch writes:

      I think we (the JSR-166 EG) were sloppy when specifying
      ThreadLocal.remove. Here's what the spec currently says:

         /**
          * Removes the value for this ThreadLocal. This may help reduce
          * the storage requirements of ThreadLocals. If this ThreadLocal
          * is accessed again, it will by default have its
          * <tt>initialValue</tt>.
          * @since 1.5
          **/

      I think that we should tighten this up, preferably in the next update release:

         /**
          * Removes the current thread's value for this thread-local variable.
          * If this thread-local variable is subsequently read by the current
          * thread, its initial value will be computed by invoking its
          * {@link #initialValue} method again unless its value is set by
          * the current thread in the interim.
          *
          * @since 1.5
          */
      ###@###.### 10/27/04 01:32 GMT

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: