diff --git a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java index 5bba31de9..3b5288c59 100644 --- a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java +++ b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java @@ -31,7 +31,8 @@ public class FullDataFileHandler implements IFullDataSourceProvider { // Note: Single main thread only for now. May make it multi-thread later, depending on the usage. private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - final ExecutorService fileReaderThread = ThreadUtil.makeThreadPool(4, FullDataFileHandler.class.getSimpleName()+"Thread"); + + final ExecutorService fileReaderThread = ThreadUtil.makeThreadPool(4, FullDataFileHandler.class.getSimpleName()+"Thread"); final ConcurrentHashMap files = new ConcurrentHashMap<>(); final IDhLevel level; final File saveDir; @@ -48,9 +49,9 @@ public class FullDataFileHandler implements IFullDataSourceProvider - /* + /** * Caller must ensure that this method is called only once, - * and that this object is not used before this method is called. + * and that the {@link FullDataFileHandler} is not used before this method is called. */ @Override public void addScannedFile(Collection detectedFiles) @@ -240,7 +241,6 @@ public class FullDataFileHandler implements IFullDataSourceProvider /** * Returns the {@link IFullDataSource} for the given section position.
- * If the section hasn't been generated this will also send a generation call, which may take a while.
* The returned data source may be null.

* * This call is concurrent. I.e. it supports being called by multiple threads at the same time. @@ -402,9 +402,9 @@ public class FullDataFileHandler implements IFullDataSourceProvider Consumer onUpdated, Function updater) { boolean changed = updater.apply(source); -// if (changed) +// if (changed) // { -// metaData.dataVersion.incrementAndGet(); +// metaData.dataVersion.incrementAndGet(); // } if (source instanceof IIncompleteFullDataSource) diff --git a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java index 8f6d4a105..f8422f5ac 100644 --- a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java +++ b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java @@ -143,10 +143,10 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile { debugPhantomLifeCycleCheck(); - CompletableFuture cached = this.getCachedDataSourceAsync(); - if (cached != null) + CompletableFuture getCachedFuture = this.getCachedDataSourceAsync(); + if (getCachedFuture != null) { - return cached; + return getCachedFuture; } @@ -346,6 +346,7 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile new DataObjTracker(fullDataSource); this.cachedFullDataSource = new SoftReference<>(fullDataSource); } + this.dataSourceWriteQueueFuture = null; this.inCacheWriteAccessFuture.set(null); return fullDataSource; @@ -356,6 +357,7 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile } + // the data source hasn't been loaded // and isn't in the process of being loaded return null;