package bluej.debugger.jdi;
import java.util.*;
import bluej.utility.Debug;
import com.sun.jdi.ThreadReference;
import threadchecker.OnThread;
import threadchecker.Tag;
| A wrapper around a TreeSet that helps us
| store JdiThreads.
|
| @author Michael Kolling
|
@OnThread(Tag.Any)
public class JdiThreadSet extends HashSet<JdiThread>{
| Construct an empty thread set.
|
public JdiThreadSet()
{
super();
}
| Find the thread in the set representing the thread reference specified.
|
public JdiThread find(ThreadReference thread)
{
for (Iterator<JdiThread> it=iterator(); it.hasNext(); ) {
JdiThread currentThread = (JdiThread)it.next();
if (currentThread.getRemoteThread().equals(thread)) {
return currentThread;
}
}
Debug.reportError("Encountered thread not in ThreadSet!");
return null;
}
| Remove the given thread from the set.
|
public JdiThread removeThread(ThreadReference thread)
{
for (Iterator<JdiThread> it=iterator(); it.hasNext(); ) {
JdiThread jdiThread = it.next();
if (jdiThread.getRemoteThread().equals(thread)) {
it.remove();
return jdiThread;
}
}
Debug.reportError("Unknown thread died!");
return null;
}
}
. JdiThreadSet
. find
. removeThread
55 neLoCode
+ 6 LoComm