//iterate and stop all daemons
while (connection != null && System.currentTimeMillis() < expiry) {
try {
if (stopped.add(connection.getDaemon().getUid())) {
LOGGER.debug("Requesting daemon {} stop now", connection.getDaemon());
stopDispatcher.dispatch(connection, new Stop(idGenerator.generateId()));
LOGGER.lifecycle("Gradle daemon stopped.");
}
} finally {
connection.stop();
}