40 |
package gnu.classpath.jdwp.id; |
package gnu.classpath.jdwp.id; |
41 |
|
|
42 |
import gnu.classpath.jdwp.JdwpConstants; |
import gnu.classpath.jdwp.JdwpConstants; |
43 |
|
import gnu.classpath.jdwp.exception.InvalidThreadException; |
44 |
|
|
45 |
/** |
/** |
46 |
* A class which represents a JDWP thread id |
* A class which represents a JDWP thread id |
62 |
{ |
{ |
63 |
super (JdwpConstants.Tag.THREAD); |
super (JdwpConstants.Tag.THREAD); |
64 |
} |
} |
65 |
|
|
66 |
|
/** |
67 |
|
* Gets the Thread represented by this ID |
68 |
|
* |
69 |
|
* @throws InvalidThreadException if thread is garbage collected, |
70 |
|
* exited, or otherwise invalid |
71 |
|
*/ |
72 |
|
public Thread getThread () |
73 |
|
throws InvalidThreadException |
74 |
|
{ |
75 |
|
Thread thread = (Thread) _reference.get (); |
76 |
|
|
77 |
|
/* Spec says if thread is null, not valid, or exited, |
78 |
|
throw invalid thread */ |
79 |
|
// FIXME: not valid? exited? Is this check valid? |
80 |
|
if (thread == null || !thread.isAlive ()) |
81 |
|
throw new InvalidThreadException (getId ()); |
82 |
|
|
83 |
|
return thread; |
84 |
|
} |
85 |
} |
} |