Search in sources :

Example 1 with StateRestApiException

use of com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException in project vespa by vespa-engine.

the class Request method doRemoteFleetControllerTask.

@Override
public final void doRemoteFleetControllerTask(Context context) {
    try {
        if (masterState == MasterState.MUST_BE_MASTER && !context.masterInfo.isMaster()) {
            Integer masterIndex = context.masterInfo.getMaster();
            if (masterIndex == null)
                throw new UnknownMasterException();
            throw new OtherMasterIndexException(masterIndex);
        }
        result = calculateResult(context);
        resultSet = true;
    } catch (OtherMasterIndexException | StateRestApiException e) {
        failure = e;
    } catch (Exception e) {
        failure = new InternalFailure("Caught unexpected exception");
        failure.initCause(e);
    }
}
Also used : UnknownMasterException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.UnknownMasterException) StateRestApiException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException) InternalFailure(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure) StateRestApiException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException) DeadlineExceededException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.DeadlineExceededException) UnknownMasterException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.UnknownMasterException)

Example 2 with StateRestApiException

use of com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException in project vespa by vespa-engine.

the class DummyStateApi method checkForInducedException.

private void checkForInducedException() throws StateRestApiException {
    if (induceException == null)
        return;
    Exception e = induceException;
    induceException = null;
    if (e instanceof RuntimeException) {
        throw (RuntimeException) e;
    }
    throw (StateRestApiException) e;
}
Also used : StateRestApiException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException) InvalidContentException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InvalidContentException) MissingUnitException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.MissingUnitException) StateRestApiException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException) OperationNotSupportedForUnitException(com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.OperationNotSupportedForUnitException)

Aggregations

StateRestApiException (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException)2 DeadlineExceededException (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.DeadlineExceededException)1 InternalFailure (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure)1 InvalidContentException (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InvalidContentException)1 MissingUnitException (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.MissingUnitException)1 OperationNotSupportedForUnitException (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.OperationNotSupportedForUnitException)1 UnknownMasterException (com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.UnknownMasterException)1