private void connectionCheck()

in java/clickhouse-connector/src/main/java/com/epam/deltix/timebase/connector/clickhouse/services/ReplicatorService.java [85:117]


    private void connectionCheck() {
        boolean notReady = true;
        boolean clickhouseReady = false;
        while (notReady) {
            if (!tickDb.isOpen()) {
                try {
                    LOG.info().append("Opening connection to TimeBase on ").append(tickDb.toString()).commit();
                    tickDb.open(true);
                } catch (Exception e) {
                    LOG.error().append("Can't open timebase ").append(tickDb.toString()).append(" ")
                            .append(e.getMessage()).commit();
                }
            }
            if (!clickhouseReady) {
                try {
                    LOG.info().append("Connection to clickhouse ").append(clickhouseProperties.getUrl()).commit();
                    Connection connection = clickhouseClient.getConnection();
                    clickhouseReady = connection.isValid(clickhouseProperties.getTimeout());
                } catch (Exception e) {
                    LOG.error().append("Can't connect to clickhouse ").append(clickhouseProperties.getUrl()).append(" ")
                            .append(e.getMessage()).commit();
                }
            }

            notReady = !tickDb.isOpen() || !clickhouseReady;
            if (notReady) {
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException ignored) {
                }
            }
        }
    }