use of org.gradle.launcher.daemon.protocol.Success 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) {
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.Success in project gradle by gradle.
the class ReportStatusDispatcher method dispatch.
public Status dispatch(Connection<Message> connection, Command statusCommand) {
Status returnedStatus = null;
Throwable failure = null;
try {
connection.dispatch(statusCommand);
Result result = (Result) connection.receive();
if (result instanceof Failure) {
failure = ((Failure) result).getValue();
} else if (result instanceof Success) {
returnedStatus = (Status) result.getValue();
}
connection.dispatch(new Finished());
} catch (Throwable e) {
failure = e;
}
if (failure != null) {
LOGGER.debug(String.format("Unable to get status of %s.", connection), failure);
}
return returnedStatus;
}
use of org.gradle.launcher.daemon.protocol.Success in project gradle by gradle.
the class HandleReportStatus method execute.
@Override
public void execute(DaemonCommandExecution execution) {
if (execution.getCommand() instanceof ReportStatus) {
String version = GradleVersion.current().getVersion();
String status = execution.getDaemonStateControl().getState().toString().toUpperCase();
Status message = new Status(execution.getDaemonContext().getPid(), version, status);
execution.getConnection().completed(new Success(message));
} else {
execution.proceed();
}
}
use of org.gradle.launcher.daemon.protocol.Success in project gradle by gradle.
the class ReturnResult method execute.
public void execute(DaemonCommandExecution execution) {
execution.proceed();
Result result;
Throwable commandException = execution.getException();
if (commandException != null) {
result = new Failure(commandException);
} else {
result = new Success(execution.getResult());
}
LOGGER.debug("Daemon is dispatching the build result: {}", result);
execution.getConnection().completed(result);
}
Aggregations