public void run() {
            List<SQLStatement> sqlStatementsToLoad = new ArrayList<>();
            int numberStatements;

            //noinspection InfiniteLoopStatement
            while (true) {
                if (unloadedSQLStatements.size() > 0) {

                    sqlStatementsToLoad.clear();
                    numberStatements = 0;

                    Iterator<SQLStatement> iterator = unloadedSQLStatements.iterator();

                    // load at most 400 statements before going to sleep
                    // 400 is a magic number - no special meaning. But keep it somehow related to the
                    // SQLTextLoadHelper and its chunk size.
                    while (iterator.hasNext() && numberStatements <= 400) {
                        sqlStatementsToLoad.add(iterator.next());
                        numberStatements++;
                    }

                    SQLTextLoadHelper.loadSQLStatements(sqlStatementsToLoad);

                    // remove the loaded statements from the list
                    for (SQLStatement statement : sqlStatementsToLoad) {
                        unloadedSQLStatements.remove(statement);
                    }
                }

                // sleep for 0.2 seconds so all the other tasks can do their work
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    // we don't care for being interrupted
                }
            }
        }