1 7 34 35 package com.sun.tools.example.debug.bdi; 36 37 import com.sun.jdi.ThreadGroupReference; 38 import com.sun.jdi.ThreadReference; 39 import java.util.List ; 40 import java.util.Iterator ; 41 42 public class ThreadIterator implements Iterator { 43 Iterator it = null; 44 ThreadGroupIterator tgi; 45 46 public ThreadIterator(ThreadGroupReference tg) { 47 tgi = new ThreadGroupIterator(tg); 48 } 49 50 public ThreadIterator(List tgl) { 52 tgi = new ThreadGroupIterator(tgl); 53 } 54 55 public boolean hasNext() { 56 while (it == null || !it.hasNext()) { 57 if (!tgi.hasNext()) { 58 return false; } 60 it = tgi.nextThreadGroup().threads().iterator(); 61 } 62 return true; 63 } 64 65 public Object next() { 66 return it.next(); 67 } 68 69 public ThreadReference nextThread() { 70 return (ThreadReference)next(); 71 } 72 73 public void remove() { 74 throw new UnsupportedOperationException (); 75 } 76 } 77 | Popular Tags |