Another note on Scala style: instead of putting `this.synchronized` inside a method, write it this way:

```
override def onStageCompleted(stageCompleted: StageCompleted): Unit = synchronized {
  // body
}
```

I guess this is slightly weirder but it's common throughout our code for methods that are fully synchronized, so we should stick with it.