private boolean handleHostsAvailabilityError()

in cassandra/src/main/java/org/apache/ignite/activestore/impl/cassandra/session/CassandraSessionImpl.java [915:941]


    private boolean handleHostsAvailabilityError(Throwable e, int attempt, String msg) {
        if (attempt >= CQL_EXECUTION_ATTEMPTS_COUNT) {
            log.error("Host availability problem detected. " +
                "Number of CQL execution attempts reached maximum " + CQL_EXECUTION_ATTEMPTS_COUNT +
                ", exception will be thrown to upper execution layer.", e);
            throw msg == null ? new IgniteException(e) : new IgniteException(msg, e);
        }
        if (attempt == CQL_EXECUTION_ATTEMPTS_COUNT / 4 ||
            attempt == CQL_EXECUTION_ATTEMPTS_COUNT / 2 ||
            attempt == CQL_EXECUTION_ATTEMPTS_COUNT / 2 + CQL_EXECUTION_ATTEMPTS_COUNT / 4 ||
            attempt == CQL_EXECUTION_ATTEMPTS_COUNT - 1) {
            log.warning("Host availability problem detected, CQL execution attempt  " + (attempt + 1) + ", " +
                "refreshing Cassandra session", e);
            refresh();
            log.warning("Cassandra session refreshed");
            return true;
        }
        log.warning("Host availability problem detected, CQL execution attempt " + (attempt + 1) + ", " +
            "sleeping extra " + CQL_EXECUTION_ATTEMPT_MAX_TIMEOUT + " milliseconds", e);
        try {
            Thread.sleep(CQL_EXECUTION_ATTEMPT_MAX_TIMEOUT);
        }
        catch (InterruptedException ignored) {
        }
        log.warning("Sleep completed");
        return false;
    }