/[classpath]/classpath/java/lang/ThreadLocal.java
ViewVC logotype

Diff of /classpath/java/lang/ThreadLocal.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Sat Aug 9 18:47:04 2003 UTC revision 1.5 by mkoch, Fri Oct 15 07:44:17 2004 UTC
# Line 41  import java.util.Collections; Line 41  import java.util.Collections;
41  import java.util.Map;  import java.util.Map;
42  import java.util.WeakHashMap;  import java.util.WeakHashMap;
43    
44    
45  /**  /**
46   * ThreadLocal objects have a different state associated with every   * ThreadLocal objects have a different state associated with every
47   * Thread that accesses them. Every access to the ThreadLocal object   * Thread that accesses them. Every access to the ThreadLocal object
# Line 51  import java.util.WeakHashMap; Line 52  import java.util.WeakHashMap;
52   * <p>The first time a ThreadLocal object is accessed on a particular   * <p>The first time a ThreadLocal object is accessed on a particular
53   * Thread, the state for that Thread's copy of the local variable is set by   * Thread, the state for that Thread's copy of the local variable is set by
54   * executing the method <code>initialValue()</code>.   * executing the method <code>initialValue()</code>.
55     * </p>
56   *   *
57   * <p>An example how you can use this:   * <p>An example how you can use this:
58     * </p>
59     *
60   * <pre>   * <pre>
61   * class Connection   * class Connection
62   * {   * {
# Line 65  import java.util.WeakHashMap; Line 69  import java.util.WeakHashMap;
69   *     };   *     };
70   * ...   * ...
71   * }   * }
72   * </pre></br>   * </pre>
73   *   *
74   * Now all instances of connection can see who the owner of the currently   * <p>Now all instances of connection can see who the owner of the currently
75   * executing Thread is by calling <code>owner.get()</code>. By default any   * executing Thread is by calling <code>owner.get()</code>. By default any
76   * Thread would be associated with 'nobody'. But the Connection object could   * Thread would be associated with 'nobody'. But the Connection object could
77   * offer a method that changes the owner associated with the Thread on   * offer a method that changes the owner associated with the Thread on
78   * which the method was called by calling <code>owner.put("somebody")</code>.   * which the method was called by calling <code>owner.put("somebody")</code>.
79   * (Such an owner changing method should then be guarded by security checks.)   * (Such an owner changing method should then be guarded by security checks.)
80     * </p>
81   *   *
82   * <p>When a Thread is garbage collected all references to values of   * <p>When a Thread is garbage collected all references to values of
83   * the ThreadLocal objects associated with that Thread are removed.   * the ThreadLocal objects associated with that Thread are removed.
84     * </p>
85   *   *
86   * @author Mark Wielaard <mark@klomp.org>   * @author Mark Wielaard (mark@klomp.org)
87   * @author Eric Blake <ebb9@email.byu.edu>   * @author Eric Blake (ebb9@email.byu.edu)
88   * @since 1.2   * @since 1.2
89   * @status updated to 1.4   * @status updated to 1.4
90   */   */

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26