|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuka.karmi.rmi.ThreadInfo
Manages transparent distributed threads in KaRMI. Each thread
that calls or services remote methods is associated with a
ThreadInfo object. The ThreadInfo object
assigns a thread ID to its owner thread. KaRMI server threads
change their thread ID according to the thread ID of the remote
method invocation they currently service.
ThreadInfo can be used to find a thread that is
associated to a given thread ID and send an interrupt to that
thread.
getThreadID(),
interrupt(long)| Field Summary | |
private static java.util.WeakHashMap |
allThreadInfos
Keeps weak references to all ThreadInfo objects
for all active threads. |
private static int |
count
|
private static java.lang.Object |
DUMMY
|
private static java.lang.ThreadLocal |
localThreadInfo
|
java.lang.Thread |
owner
The thread this thread info belongs to. |
long |
tid
The thread ID associated to the owning thread. |
| Constructor Summary | |
protected |
ThreadInfo()
A ThreadInfo object is created automatically for a
thread, if this thread calls getThreadID() the
first time. |
| Method Summary | |
private static long |
createID()
Creates a new globally unique identifier that can be used as thread ID. |
protected long |
getID()
|
static long |
getThreadID()
Returns the thread ID of the current thread. |
static boolean |
interrupt(long tid)
Sends an interrupt signal to the thread with the given thread ID. |
protected long |
setID(long tid)
|
static long |
setThreadID(long tid)
Assigns a new thread ID to the current thread. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final java.lang.Thread owner
public long tid
private static final java.lang.ThreadLocal localThreadInfo
private static java.util.WeakHashMap allThreadInfos
Keeps weak references to all ThreadInfo objects
for all active threads. Keys in this hash table are the
ThreadInfo objects. The associated value for all
key is the object DUMMY.
This data structure enables finding a thread for a given thread ID without registering a thread in a hash table each time a new thread ID is assigned to that thread. Therefore assigning a thread ID to a thread has no extra cost, but finding a thread for a given thread ID slower, because a linear search over all threads is required. This timing property is important, because assigning a thread ID to a thread is a frequent operation (each remote method invocation assigns the current thread ID to its server thread), but finding a thread for a given thread ID is only necessary during remote interrupt forwarding.
DUMMYprivate static java.lang.Object DUMMY
allThreadInfosprivate static int count
| Constructor Detail |
protected ThreadInfo()
ThreadInfo object is created automatically for a
thread, if this thread calls getThreadID() the
first time.
getThreadID()| Method Detail |
protected final long getID()
protected final long setID(long tid)
public static long getThreadID()
Thread.currentThread().public static long setThreadID(long tid)
public static boolean interrupt(long tid)
private static long createID()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||