コード例 #1
0
ファイル: ShowComp.java プロジェクト: vishalshar/NetMon
 public void run() {
   try {
     for (; ; ) {
       Target t = null;
       synchronized (pending) {
         while (pending.size() == 0) pending.wait();
         t = (Target) pending.removeFirst();
       }
       t.show();
     }
   } catch (InterruptedException x) {
     return;
   }
 }
コード例 #2
0
 public void printFinishedTargets() {
   // 打印finisedTargets队列中的任务
   try {
     for (; ; ) {
       Target target = null;
       synchronized (finishedTargets) {
         while (finishedTargets.size() == 0) finishedTargets.wait();
         target = (Target) finishedTargets.removeFirst();
       }
       target.show();
     }
   } catch (InterruptedException x) {
     return;
   }
 }