KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > core > ThreadStateMapping2


1
2 package org.python.core;
3
4 class ThreadStateMapping2 extends ThreadStateMapping {
5     private static ThreadLocal JavaDoc cachedThreadState = new ThreadLocal JavaDoc();
6
7     public ThreadState getThreadState(PySystemState newSystemState) {
8         ThreadState ts = (ThreadState)cachedThreadState.get();
9         if (ts != null) {
10             return ts;
11         }
12
13         Thread JavaDoc t = Thread.currentThread();
14
15         if (newSystemState == null) {
16             Py.writeDebug("threadstate", "no current system state");
17             //t.dumpStack();
18
newSystemState = Py.defaultSystemState;
19         }
20
21         ts = new ThreadState(t, newSystemState);
22         cachedThreadState.set(ts);
23         return ts;
24     }
25 }
26
Popular Tags