Search in sources :

Example 1 with Success

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();
    }
}
Also used : Stop(org.gradle.launcher.daemon.protocol.Stop) StopWhenIdle(org.gradle.launcher.daemon.protocol.StopWhenIdle) DaemonExpirationResult(org.gradle.launcher.daemon.server.expiry.DaemonExpirationResult) Success(org.gradle.launcher.daemon.protocol.Success)

Example 2 with Success

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;
}
Also used : Status(org.gradle.launcher.daemon.protocol.Status) Finished(org.gradle.launcher.daemon.protocol.Finished) Failure(org.gradle.launcher.daemon.protocol.Failure) Success(org.gradle.launcher.daemon.protocol.Success) Result(org.gradle.launcher.daemon.protocol.Result)

Example 3 with Success

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();
    }
}
Also used : ReportStatus(org.gradle.launcher.daemon.protocol.ReportStatus) Status(org.gradle.launcher.daemon.protocol.Status) ReportStatus(org.gradle.launcher.daemon.protocol.ReportStatus) Success(org.gradle.launcher.daemon.protocol.Success)

Example 4 with Success

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);
}
Also used : Failure(org.gradle.launcher.daemon.protocol.Failure) Success(org.gradle.launcher.daemon.protocol.Success) Result(org.gradle.launcher.daemon.protocol.Result)

Aggregations

Success (org.gradle.launcher.daemon.protocol.Success)4 Failure (org.gradle.launcher.daemon.protocol.Failure)2 Result (org.gradle.launcher.daemon.protocol.Result)2 Status (org.gradle.launcher.daemon.protocol.Status)2 Finished (org.gradle.launcher.daemon.protocol.Finished)1 ReportStatus (org.gradle.launcher.daemon.protocol.ReportStatus)1 Stop (org.gradle.launcher.daemon.protocol.Stop)1 StopWhenIdle (org.gradle.launcher.daemon.protocol.StopWhenIdle)1 DaemonExpirationResult (org.gradle.launcher.daemon.server.expiry.DaemonExpirationResult)1