private void handleTableAbsenceError()

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


    private void handleTableAbsenceError(KeyValuePersistenceSettings settings) {
        int hndNum = tblAbsenceHandlersCnt.incrementAndGet();
        try {
            synchronized (tblAbsenceHandlersCnt) {
                // Oooops... I am not the first thread who tried to handle table absence problem.
                if (hndNum != 0) {
                    log.warning("Table " + settings.getTableFullName() + " absence problem detected. " +
                        "Another thread already fixed it.");
                    return;
                }
                log.warning("Table " + settings.getTableFullName() + " absence problem detected. " +
                    "Trying to create table.");
                IgniteException error = new IgniteException("Failed to create Cassandra table " +
                    settings.getTableFullName());
                int attempt = 0;
                while (error != null && attempt < CQL_EXECUTION_ATTEMPTS_COUNT) {
                    error = null;
                    try {
                        createTable(settings);
                    }
                    catch (Throwable e) {
                        if (CassandraHelper.isHostsAvailabilityError(e)) {
                            handleHostsAvailabilityError(e, attempt, null);
                        }
                        else {
                            throw new IgniteException("Failed to create Cassandra table " + settings.getTableFullName(),
                                e);
                        }
                        error = (e instanceof IgniteException) ? (IgniteException)e : new IgniteException(e);
                    }
                    attempt++;
                }
                if (error != null) {
                    throw error;
                }
            }
        }
        finally {
            if (hndNum == 0) {
                tblAbsenceHandlersCnt.set(-1);
            }
        }
    }