private boolean shouldRetryWithOTSException()

in tablestore/src/main/java/com/alicloud/openservices/tablestore/model/CustomRetryStrategy.java [72:102]


    private boolean shouldRetryWithOTSException(String action, boolean isIdempotent, String errorCode,
                                                String errorMessage, int httpStatus) {
        /**
         * When these errors occur, retry regardless of whether it is a read or write operation.
         */
        if (retryNotMatterActions(errorCode, errorMessage)) {
            return true;
        }

        // Determine whether it is a service layer error.
        boolean serverError = (httpStatus >= 500 && httpStatus <= 599)
                            || errorCode.equals(ErrorCode.STORAGE_TIMEOUT)
                            || errorCode.equals(ErrorCode.INTERNAL_SERVER_ERROR)
                            || errorCode.equals(ErrorCode.SERVER_UNAVAILABLE)
                            || errorCode.equals(ErrorCode.TUNNEL_SERVER_UNAVAILABLE);

        // For service layer errors, and the operation is an idempotent operation, retry.
        if (serverError && isIdempotent) {
            return true;
        }

        // For service-level errors, and for write operations (non-idempotent), the retryUnIdempotentWriteOperation switch is used to determine whether to retry.
        if (serverError && retryUnIdempotentWriteOperation && (OP_UPDATE_ROW.equals(action)
                                                || OP_PUT_ROW.equals(action)
                                                || OP_BATCH_WRITE_ROW.equals(action))) {
            return true;
        }

        // For cases other than the above, no retries will be attempted.
        return false;
    }