IndexVersion (@NotNull ID<?, ?> indexName) { IndexVersion version = ourIndexIdToCreationStamp.get(indexName.getUniqueId()); if (version != null) { return version; } //noinspection SynchronizeOnThis synchronized (IndexVersion.class) { version = ourIndexIdToCreationStamp.get(indexName.getUniqueId()); if (version != null) return version; try { Path versionFile = IndexInfrastructure.getVersionFile(indexName); try (DataInputStream in = new DataInputStream(new BufferedInputStream(Files.newInputStream(versionFile)))) { version = new IndexVersion(in); LOG.debug("Version for index '", indexName, "' from file ", versionFile, ": ", version); } } catch (IOException e) { version = NON_EXISTING_INDEX_VERSION; LOG.debug("No version for index '" + indexName + "' (" + e + ")", e); } Int2ObjectMap<IndexVersion> newCopy = new Int2ObjectOpenHashMap<>(ourIndexIdToCreationStamp); newCopy.put(indexName.getUniqueId(), version); ourIndexIdToCreationStamp = newCopy; } return version; }