@Override
protected void sendResponse(OutputStream output) throws IOException {
List<ResultHandler<?, Void>> results = new ArrayList<ResultHandler<?, Void>>(updates.size());
final CountDownLatch latch = new CountDownLatch(1);
final ServerUpdateController controller = new ServerUpdateController(serverController.getServerModel(),
serviceContainer, executor,
new ServerUpdateCommitHandler() {
public void handleUpdateCommit(ServerUpdateController controller, Status priorStatus) {
configurationPersister.configurationModified();
latch.countDown();
}
}, true, ! preventShutdown);
boolean requiresRestart = false;
for(final AbstractServerModelUpdate<?> update : updates) {
requiresRestart |= update.requiresRestart();
results.add(addUpdate(update, controller));
}
controller.executeUpdates();
try {
latch.await();
} catch(Exception e) {
throw new ManagementException("failed to execute updates", e);
}