1 package org.oddjob.jobs.structural; 2 3 4 import org.oddjob.Stoppable; 5 import org.oddjob.Structural; 6 import org.oddjob.framework.StructuralJob; 7 8 31 32 public class SequentialJob extends StructuralJob 33 implements Structural, Stoppable { 34 private static final long serialVersionUID = 20051206; 35 36 45 public void addComponent(Object child) { 46 childHelper.addChild(child); 47 } 48 49 public void init() { 50 childHelper.initialise(); 51 } 52 53 57 public void execute() throws Exception { 58 Object [] children = childHelper.getChildren(); 59 for (int i = 0; i < children.length && !stop; ++i) { 60 if (childHelper.anyNotComplete() || 61 childHelper.anyExceptions() != null) { 62 return; 63 } 64 Object child = children[i]; 65 if (!(child instanceof Runnable )) { 66 continue; 67 } 68 69 Runnable job = (Runnable ) child; 70 job.run(); 71 } 72 } 73 74 } 75 | Popular Tags |