test/java/beans/XMLDecoder/8028054/TestConstructorFinder.java

Print this page




  56                 }
  57             });
  58         }
  59         int alarm = 0;
  60         while (true) {
  61             int alive = 0;
  62             int working = 0;
  63             for (Task task : tasks) {
  64                 if (task.isWorking()) {
  65                     working++;
  66                     alive++;
  67                 } else if (task.isAlive()) {
  68                     alive++;
  69                 }
  70             }
  71             if (alive == 0) {
  72                 break;
  73             }
  74             Task.print(working + " out of " + alive + " threads are working");
  75             if ((working == 0) && (++alarm == 10)) {
  76                 Task.print("DEADLOCK DETECTED");
  77                 System.exit(100);
  78             }
  79             Thread.sleep(1000);
  80         }
  81     }
  82 }


  56                 }
  57             });
  58         }
  59         int alarm = 0;
  60         while (true) {
  61             int alive = 0;
  62             int working = 0;
  63             for (Task task : tasks) {
  64                 if (task.isWorking()) {
  65                     working++;
  66                     alive++;
  67                 } else if (task.isAlive()) {
  68                     alive++;
  69                 }
  70             }
  71             if (alive == 0) {
  72                 break;
  73             }
  74             Task.print(working + " out of " + alive + " threads are working");
  75             if ((working == 0) && (++alarm == 10)) {
  76                 throw new RuntimeException("FAIL - DEADLOCK DETECTED");

  77             }
  78             Thread.sleep(1000);
  79         }
  80     }
  81 }