예제 #1
0
 public void join(String msg) throws MonitorCanceledException {
   MON.checkMonitor(this);
   MON.setMonitor(parent);
   parent.setChild(null);
   parent.message(msg);
   done();
 }
예제 #2
0
 protected void message(String msg, int level) {
   if (parent != null) {
     parent.message(msg, level + 1);
   } else {
     trace(msg, level, false);
   }
 }
예제 #3
0
 protected void taskChanged(String task, int level) {
   if (parent != null) {
     parent.taskChanged(task, level + 1);
   } else {
     trace(task, level, true);
   }
 }
예제 #4
0
 protected void dump(StringBuilder builder) {
   builder.append("  ");
   builder.append(task);
   builder.append("\n");
   if (parent != null) {
     parent.dump(builder);
   }
 }
예제 #5
0
  public void fork(int workFromParent, Runnable runnable, String msg)
      throws MonitorCanceledException {
    MON.checkMonitor(this);
    checkWork(workFromParent);

    child = subMonitor(workFromParent);
    MON.setMonitor(child);

    try {
      runnable.run();
    } finally {
      MON.checkMonitor(child);
      MON.setMonitor(this);
      child.done();
      child = null;
    }

    work += workFromParent;
    message(msg);
  }
예제 #6
0
 protected void setCanceled(boolean canceled) {
   this.canceled = canceled;
   if (child != null) {
     child.setCanceled(canceled);
   }
 }