Search in sources :

Example 1 with ErrorCode

use of org.openkilda.floodlight.flow.response.FlowErrorResponse.ErrorCode in project open-kilda by telstra.

the class SpeakerCommandFsm method processResponse.

protected void processResponse(State from, State to, Event event, SpeakerFlowSegmentResponse response) {
    if (response.isSuccess()) {
        log.debug("Successfully executed the command {}", response);
        fire(Event.NEXT);
    } else {
        FlowErrorResponse errorResponse = (FlowErrorResponse) response;
        final ErrorCode errorCode = errorResponse.getErrorCode();
        String giveUpReason = null;
        if (remainingRetries <= 0) {
            giveUpReason = String.format("all %s retry attempts have been used", allowedRetriesCount);
        } else if (giveUpErrors.contains(errorCode)) {
            giveUpReason = String.format("Error %s is in \"give up\" list, no more retry attempts allowed", errorCode);
        }
        if (giveUpReason == null) {
            remainingRetries--;
            log.debug("About to retry execution of the command {}", response);
            fire(Event.RETRY);
        } else {
            fireError(giveUpReason);
        }
    }
}
Also used : FlowErrorResponse(org.openkilda.floodlight.flow.response.FlowErrorResponse) ErrorCode(org.openkilda.floodlight.flow.response.FlowErrorResponse.ErrorCode)

Aggregations

FlowErrorResponse (org.openkilda.floodlight.flow.response.FlowErrorResponse)1 ErrorCode (org.openkilda.floodlight.flow.response.FlowErrorResponse.ErrorCode)1