use of org.gradle.launcher.daemon.protocol.StopWhenIdle in project gradle by gradle.
the class HandleStop method execute.
@Override
public void execute(DaemonCommandExecution execution) {
if (execution.getCommand() instanceof Stop) {
listenerBroadcast.onExpirationEvent(new DaemonExpirationResult(DaemonExpirationStatus.IMMEDIATE_EXPIRE, EXPIRATION_REASON));
execution.getConnection().completed(new Success(null));
} else if (execution.getCommand() instanceof StopWhenIdle) {
hangShutdownForTesting();
listenerBroadcast.onExpirationEvent(new DaemonExpirationResult(DaemonExpirationStatus.GRACEFUL_EXPIRE, EXPIRATION_REASON));
execution.getConnection().completed(new Success(null));
} else {
execution.proceed();
}
}
use of org.gradle.launcher.daemon.protocol.StopWhenIdle in project gradle by gradle.
the class DaemonStopClient method gracefulStop.
/**
* Requests that the given daemons stop when idle. Does not block and returns before the daemons have all stopped.
*/
public void gracefulStop(Collection<DaemonConnectDetails> daemons) {
for (DaemonConnectDetails daemon : daemons) {
DaemonClientConnection connection = connector.maybeConnect(daemon);
if (connection == null) {
continue;
}
try {
LOGGER.debug("Requesting daemon {} stop when idle", daemon);
stopDispatcher.dispatch(connection, new StopWhenIdle(idGenerator.generateId(), connection.getDaemon().getToken()));
LOGGER.lifecycle("Gradle daemon stopped.");
} finally {
connection.stop();
}
}
}
Aggregations