VFSInitializationResult (@NotNull Path cachesDir, int expectedVersion, boolean enableVfsLog, List<ConnectionInterceptor> interceptors) { List<Throwable> attemptsFailures = new ArrayList<>(); long initializationStartedNs = System.nanoTime(); for (int attempt = 0; attempt < MAX_INITIALIZATION_ATTEMPTS; attempt++) { try { PersistentFSConnection connection = tryInit( cachesDir, expectedVersion, enableVfsLog, interceptors, RECOVERERS, attempt == 0 ); //heuristics: just created VFS contains only 1 record (=super-root): boolean justCreated = connection.getRecords().recordsCount() == 1 && connection.isDirty(); return new VFSInitializationResult( connection, justCreated, attemptsFailures, System.nanoTime() - initializationStartedNs ); } catch (Exception e) { LOG.info("Init VFS attempt #" + attempt + " failed: " + e.getMessage()); attemptsFailures.add(e); } } RuntimeException fail = new RuntimeException("VFS can't be initialized (" + MAX_INITIALIZATION_ATTEMPTS + " attempts failed)"); for (Throwable failure : attemptsFailures) { fail.addSuppressed(failure); } throw fail; }