Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add listeners in constructor

  • Loading branch information...
commit f0b43774c2fbfa40a2924e0cdb673c1aa989a9e2 1 parent a7e5250
@philandstuff authored
Showing with 7 additions and 8 deletions.
  1. +7 −8 src/main/com/thoughtworks/go/monitor/BuildStatusMonitor.java
View
15 src/main/com/thoughtworks/go/monitor/BuildStatusMonitor.java
@@ -16,15 +16,13 @@
private boolean borked = false;
private final PipelineReader pipelineReader;
- public BuildStatusMonitor(String pipelineName, String stageName, String goServer) {
+ public BuildStatusMonitor(String pipelineName, String stageName, String goServer, BuildMonitorListener... listeners) {
pipelineReader = new PipelineReader(pipelineName, stageName, goServer);
- BlameMonitor blameMonitor = new BlameMonitor();
- blameMonitor.createWindow();
- listeners.add(blameMonitor);
- listeners.add(new SongListener());
+ for (BuildMonitorListener listener : listeners) {
+ this.listeners.add(listener);
+ }
- blameMonitor.createWindow();
}
public void pollForNewCompletion() {
@@ -69,8 +67,9 @@ private boolean isBroken(Stage stage) {
}
public static void main(String[] args) throws InterruptedException {
- Thread.sleep(100);
- BuildStatusMonitor monitor = new BuildStatusMonitor("all", "build", "twu-ci");
+ BlameMonitor blameMonitor = new BlameMonitor();
+ blameMonitor.createWindow();
+ BuildStatusMonitor monitor = new BuildStatusMonitor("all", "build", "twu-ci", blameMonitor, new SongListener());
while (true) {
try {
monitor.pollForNewCompletion();
Please sign in to comment.
Something went wrong with that request. Please try again.