From 2c1bc95166ad9db13f330b23ca2070d97e551247 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 31 Oct 2024 22:24:56 +0800 Subject: [PATCH] add comments explaining current exception behavior --- src/main/java/com/conveyal/r5/analyst/NetworkPreloader.java | 3 ++- src/main/java/com/conveyal/r5/util/AsyncLoader.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/conveyal/r5/analyst/NetworkPreloader.java b/src/main/java/com/conveyal/r5/analyst/NetworkPreloader.java index 10a59d4fb..083ad2aa9 100644 --- a/src/main/java/com/conveyal/r5/analyst/NetworkPreloader.java +++ b/src/main/java/com/conveyal/r5/analyst/NetworkPreloader.java @@ -94,7 +94,8 @@ public LoaderState preload (AnalysisWorkerTask task) { * similar tasks will make interleaved calls to setProgress (with superficial map synchronization). Other than * causing a value to briefly revert from PRESENT to BUILDING this doesn't seem deeply problematic. * This is provided specifically for regional tasks, to ensure that they remain in preloading mode while all this - * data is prepared. + * data is prepared. + * Any exceptions that occur while building the network will escape this method, leaving the status as BUILDING. */ public TransportNetwork preloadBlocking (AnalysisWorkerTask task) { return getBlocking(Key.forTask(task)); diff --git a/src/main/java/com/conveyal/r5/util/AsyncLoader.java b/src/main/java/com/conveyal/r5/util/AsyncLoader.java index 5165385d7..62fe4034b 100644 --- a/src/main/java/com/conveyal/r5/util/AsyncLoader.java +++ b/src/main/java/com/conveyal/r5/util/AsyncLoader.java @@ -97,7 +97,10 @@ public String toString() { } } - /** This has been factored out of the executor runnables so subclasses can force a blocking (non-async) load. */ + /** + * This has been factored out of the executor runnables so subclasses can force a blocking (non-async) load. + * Any exceptions that occur while building the value will escape this method, leaving the status as BUILDING. + */ protected V getBlocking (K key) { setProgress(key, 0, "Starting..."); V value = buildValue(key); @@ -111,6 +114,7 @@ protected V getBlocking (K key) { * Attempt to fetch the value for the supplied key. * If the value is not yet present, and not yet being computed / fetched, enqueue a task to do so. * Return a response that reports status, and may or may not contain the value. + * Any exception that occurs while building the value is caught and associated with the key with a status of ERROR. */ public LoaderState get (K key) { LoaderState state = null;