示例#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);
   }
 }