public void waitForBuildToComplete(int max_wait) { RunListener.all().add(this); synchronized (this) { // check that the build is not already complete Run lastRun = this.job.getLastCompletedBuild(); if (lastRun != null) { int lastNumber = lastRun.getNumber(); if (lastNumber >= this.buildNumber) { return; } } try { this.wait(max_wait); } catch (InterruptedException ie) { return; } } this.unregister(); }
/** Fires the {@link #onFinalized(Run)} event. */ public static void fireDeleted(Run r) { for (RunListener l : all()) { if (l.targetType.isInstance(r)) l.onDeleted(r); } }
/** Fires the {@link #onStarted} event. */ public static void fireStarted(Run r, TaskListener listener) { for (RunListener l : all()) { if (l.targetType.isInstance(r)) l.onStarted(r, listener); } }