I would do something like

```
val killHandler = if (killEnabled) {
  ...
} else {
  Array[ServletContextHandler]
}
```

and then in the end `++` them together. See how this is done in SparkUI's handlers.