diff --git a/build.xml b/build.xml index 766d1a6c581997eef63856e2a17c69c590fbe991..84ea539f8479df6aca19339e1b878a1598d6f195 100644 --- a/build.xml +++ b/build.xml @@ -38,6 +38,7 @@ <!-- Compile to classes/ --> <javac srcdir="${src.dir}" destdir="${classes.dir}" + excludes="**/Scratch*.java" classpathref="library.classpath" nowarn="true" fork="true" diff --git a/src/org/opensha2/calc/AsyncList.java b/src/org/opensha2/calc/AsyncList.java index 6248a6db4aa3275c6c4044ee3d24ed9f645722e1..f3b6ac073449c910251c7b775b782c70d1ce7bed 100644 --- a/src/org/opensha2/calc/AsyncList.java +++ b/src/org/opensha2/calc/AsyncList.java @@ -24,16 +24,16 @@ final class AsyncList<T> extends AbstractList<ListenableFuture<T>> { } /** - * Creates a new {@code AsynList} with an inital capacity of 256 elements. - * @return a new {@code AsynList} + * Creates a new {@code AsyncList} with an initial capacity of 256 elements. + * @return a new {@code AsyncList} */ static <T> AsyncList<T> create() { return new AsyncList<T>(256); } /** - * Creates a new {@code AsynList} with the specified inital capacity. - * @return a new {@code AsynList} + * Creates a new {@code AsyncList} with the specified initial capacity. + * @return a new {@code AsyncList} */ static <T> AsyncList<T> createWithCapacity(int initialCapacity) { return new AsyncList<T>(initialCapacity); diff --git a/src/org/opensha2/calc/CalcConfig.java b/src/org/opensha2/calc/CalcConfig.java index 65ad152666bb26dcd832cb2e49e6a631dbcb08d3..5e5b9ff8b02db659d0714565f713bb4e057e33d7 100644 --- a/src/org/opensha2/calc/CalcConfig.java +++ b/src/org/opensha2/calc/CalcConfig.java @@ -123,7 +123,7 @@ public final class CalcConfig { } return new StringBuilder("Calc config:") - .append(format(Key.RESOURCE)).append(resource) + .append(format(Key.RESOURCE)).append(resource.toAbsolutePath().normalize()) .append(format(Key.EXCEEDANCE_MODEL)).append(exceedanceModel) .append(format(Key.TRUNCATION_LEVEL)).append(truncationLevel) .append(format(Key.IMTS)).append(Parsing.enumsToString(imts, Imt.class)) diff --git a/src/org/opensha2/calc/Sites.java b/src/org/opensha2/calc/Sites.java index 2a5fdee679535cb33c31eab2ec788ce76f35b709..479fb283e71f8e593a30f276acecfd8c37510241 100644 --- a/src/org/opensha2/calc/Sites.java +++ b/src/org/opensha2/calc/Sites.java @@ -204,7 +204,7 @@ public final class Sites { boolean region = this instanceof RegionIterable; int size = region ? ((RegionIterable) this).region.size() : Iterables.size(this); StringBuilder sb = new StringBuilder() - .append(region ? "Region" : "List") + .append(region ? ((RegionIterable) this).region.name() + " Region" : "List") .append(" [size=").append(size).append("]"); if (!region) { for (Site site : Iterables.limit(this, TO_STRING_LIMIT)) { diff --git a/src/org/opensha2/eq/model/ModelConfig.java b/src/org/opensha2/eq/model/ModelConfig.java index 2d94b66632bcdb0c5f91292de6591f234ebbb2a1..2d5a13dc837a77e75e3e3fe1b599c3ee2b733d37 100644 --- a/src/org/opensha2/eq/model/ModelConfig.java +++ b/src/org/opensha2/eq/model/ModelConfig.java @@ -83,7 +83,7 @@ final class ModelConfig { @Override public String toString() { return new StringBuilder("Model config:") .append(format(Key.NAME)).append(name) - .append(format(Key.RESOURCE)).append(resource) + .append(format(Key.RESOURCE)).append(resource.toAbsolutePath().normalize()) .append(format(Key.SURFACE_SPACING)).append(surfaceSpacing) .append(format(Key.RUPTURE_FLOATING)).append(ruptureFloating) .append(format(Key.RUPTURE_VARIABILITY)).append(ruptureVariability) diff --git a/src/org/opensha2/programs/HazardCalc.java b/src/org/opensha2/programs/HazardCalc.java index b8c9806dc65f95d1e8fa09529b6b61a49348b27b..0a88b6092bb072876ac75964685137b64fcd77f6 100644 --- a/src/org/opensha2/programs/HazardCalc.java +++ b/src/org/opensha2/programs/HazardCalc.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; import java.util.logging.Logger; import org.opensha2.calc.CalcConfig; @@ -109,7 +110,7 @@ public class HazardCalc { Iterable<Site> sites = readSites(args[1]); log.info(""); - log.info("Sites:" + sites); + log.info("Sites: " + sites); calc(model, config, sites, out, log); log.info(PROGRAM + ": finished"); @@ -157,6 +158,8 @@ public class HazardCalc { Logger log) throws IOException { ExecutorService execSvc = createExecutor(); + int threadCount = ((ThreadPoolExecutor) execSvc).getCorePoolSize(); + log.info("Threads: " + threadCount); Optional<Executor> executor = Optional.<Executor> of(execSvc); log.info(PROGRAM + ": calculating ..."); @@ -211,12 +214,16 @@ public class HazardCalc { Site site, Optional<Executor> executor) { + // TODO not sure why we're mandating an executor here. + // legacy from refactoring? Optional<Executor> execLocal = executor.or(Optional.of(createExecutor())); try { Hazard result = Calcs.hazard(model, config, site, execLocal); // Shut down the locally created executor if none was supplied - if (!executor.isPresent()) ((ExecutorService) execLocal.get()).shutdown(); + if (!executor.isPresent()) { + ((ExecutorService) execLocal.get()).shutdown(); + } return result; } catch (ExecutionException | InterruptedException e) { Throwables.propagate(e);