38 |
|
|
39 |
package java.lang; |
package java.lang; |
40 |
|
|
41 |
|
import java.util.Map; |
42 |
|
import java.util.WeakHashMap; |
43 |
|
|
44 |
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 |
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 |
45 |
* "The Java Language Specification", ISBN 0-201-63451-1 |
* "The Java Language Specification", ISBN 0-201-63451-1 |
133 |
/** The next thread number to use. */ |
/** The next thread number to use. */ |
134 |
private static int numAnonymousThreadsCreated; |
private static int numAnonymousThreadsCreated; |
135 |
|
|
136 |
|
/** Thread local storage. Package accessible for use by |
137 |
|
* InheritableThreadLocal. |
138 |
|
*/ |
139 |
|
WeakHashMap locals; |
140 |
|
|
141 |
/** |
/** |
142 |
* Allocates a new <code>Thread</code> object. This constructor has |
* Allocates a new <code>Thread</code> object. This constructor has |
143 |
* the same effect as <code>Thread(null, null,</code> |
* the same effect as <code>Thread(null, null,</code> |
980 |
{ |
{ |
981 |
group.removeThread(this); |
group.removeThread(this); |
982 |
vmThread = null; |
vmThread = null; |
983 |
|
locals = null; |
984 |
|
} |
985 |
|
|
986 |
|
/** |
987 |
|
* Returns the map used by ThreadLocal to store the thread local values. |
988 |
|
*/ |
989 |
|
static Map getThreadLocals() |
990 |
|
{ |
991 |
|
Thread thread = currentThread(); |
992 |
|
Map locals = thread.locals; |
993 |
|
if (locals == null) |
994 |
|
{ |
995 |
|
locals = thread.locals = new WeakHashMap(); |
996 |
|
} |
997 |
|
return locals; |
998 |
} |
} |
999 |
|
|
1000 |
/** |
/** |