if (connection == null) {
continue;
}
try {
LOGGER.debug("Requesting daemon {} stop when idle", daemon);
stopDispatcher.dispatch(connection, new StopWhenIdle(idGenerator.generateId()));
LOGGER.lifecycle("Gradle daemon stopped.");
} finally {
connection.stop();
}
}