org.ini4j
ini4j
diff --git a/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/jobprocess/PyNNJobProcess.java b/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/jobprocess/PyNNJobProcess.java
index f8ca286ace..b4a614402c 100644
--- a/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/jobprocess/PyNNJobProcess.java
+++ b/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/jobprocess/PyNNJobProcess.java
@@ -60,7 +60,7 @@
import uk.ac.manchester.spinnaker.nmpi.model.job.Status;
import uk.ac.manchester.spinnaker.nmpi.model.job.pynn.PyNNJobParameters;
import uk.ac.manchester.spinnaker.nmpi.model.machine.SpinnakerMachine;
-import uk.ac.manchester.spinnaker.nmpiexec.utils.ThreadUtils;
+import uk.ac.manchester.spinnaker.utils.ThreadUtils;
/**
* A process for running PyNN jobs.
diff --git a/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/utils/ThreadUtils.java b/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/utils/ThreadUtils.java
deleted file mode 100644
index 0f31aed1ba..0000000000
--- a/SpiNNaker-nmpiexec/src/main/java/uk/ac/manchester/spinnaker/nmpiexec/utils/ThreadUtils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2014 The University of Manchester
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package uk.ac.manchester.spinnaker.nmpiexec.utils;
-
-/**
- * Utilities for working with threads.
- */
-public abstract class ThreadUtils {
-
- /**
- * Avoid instantiation.
- */
- private ThreadUtils() {
- }
-
- /**
- * Recommended way of doing "quiet" sleeps.
- *
- * @param delay
- * How long to sleep for, in milliseconds.
- * @see Stack Overflow
- * Question: When does Java's Thread.sleep throw
- * InterruptedException?
- */
- public static void sleep(final long delay) {
- try {
- Thread.sleep(delay);
- } catch (final InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-}
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/ThreadUtils.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/ThreadUtils.java
deleted file mode 100644
index 1709085b8a..0000000000
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/ThreadUtils.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2014 The University of Manchester
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package uk.ac.manchester.spinnaker.nmpi;
-
-/**
- * Utilities for working with threads.
- */
-public abstract class ThreadUtils {
-
- /**
- * Avoid creation.
- */
- private ThreadUtils() {
- }
-
- /**
- * Recommended way of doing "quiet" sleeps.
- *
- * @param delay
- * How long to sleep for, in milliseconds.
- * @see Stack Overflow
- * Question: When does Java's Thread.sleep throw
- * InterruptedException?
- */
- public static void sleep(final long delay) {
- try {
- Thread.sleep(delay);
- } catch (final InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
- /**
- * Wait for the given object.
- *
- * @param obj
- * The object to wait for
- * @return True if the wait was interrupted, false otherwise
- */
- public static boolean waitfor(final Object obj) {
- try {
- obj.wait();
- return false;
- } catch (final InterruptedException e) {
- return true;
- }
- }
-
- /**
- * Wait for the given object.
- *
- * @param obj
- * The object to wait for
- * @param timeout
- * The maximum time to wait, in milliseconds
- * @return True if the wait was interrupted, false otherwise
- */
- public static boolean waitfor(final Object obj, final long timeout) {
- try {
- obj.wait(timeout);
- return false;
- } catch (final InterruptedException e) {
- return true;
- }
- }
-}
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/DockerExecutorFactory.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/DockerExecutorFactory.java
index 58300fab01..790a8e15c9 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/DockerExecutorFactory.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/DockerExecutorFactory.java
@@ -18,7 +18,7 @@
import static java.util.Objects.requireNonNull;
import static java.util.UUID.randomUUID;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import static uk.ac.manchester.spinnaker.nmpi.model.job.JobManagerInterface.JOB_PROCESS_MANAGER;
import java.io.IOException;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/JobManager.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/JobManager.java
index b0228904d9..f7a222094d 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/JobManager.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/JobManager.java
@@ -34,7 +34,7 @@
import static org.apache.commons.io.FileUtils.forceMkdirParent;
import static org.apache.commons.io.FileUtils.listFiles;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import java.io.File;
import java.io.IOException;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/LocalJobExecuterFactory.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/LocalJobExecuterFactory.java
index 911868e623..a0e67a6302 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/LocalJobExecuterFactory.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/LocalJobExecuterFactory.java
@@ -25,7 +25,7 @@
import static org.apache.commons.io.IOUtils.closeQuietly;
import static org.apache.commons.io.IOUtils.copy;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import static uk.ac.manchester.spinnaker.nmpi.model.job.JobManagerInterface.JOB_PROCESS_MANAGER;
import java.io.BufferedReader;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/OutputManagerImpl.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/OutputManagerImpl.java
index 83feb0b14c..83a822c2cf 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/OutputManagerImpl.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/OutputManagerImpl.java
@@ -29,7 +29,7 @@
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import java.io.File;
import java.io.FileInputStream;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/XenVMExecuterFactory.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/XenVMExecuterFactory.java
index bb7f7a0267..62d09cc84e 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/XenVMExecuterFactory.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/jobmanager/XenVMExecuterFactory.java
@@ -26,8 +26,8 @@
import static java.util.Objects.requireNonNull;
import static java.util.UUID.randomUUID;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.sleep;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.sleep;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import static uk.ac.manchester.spinnaker.nmpi.model.job.JobManagerInterface.JOB_PROCESS_MANAGER;
import java.io.IOException;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/FixedMachineManagerImpl.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/FixedMachineManagerImpl.java
index 3fd9ed7c99..6e7d0e725a 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/FixedMachineManagerImpl.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/FixedMachineManagerImpl.java
@@ -16,7 +16,7 @@
package uk.ac.manchester.spinnaker.nmpi.machinemanager;
import static java.util.Objects.nonNull;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import java.util.ArrayList;
import java.util.HashSet;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/SpallocMachineManagerImpl.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/SpallocMachineManagerImpl.java
index 9de5869c1f..013a771cfb 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/SpallocMachineManagerImpl.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/machinemanager/SpallocMachineManagerImpl.java
@@ -26,8 +26,8 @@
import static org.apache.commons.io.IOUtils.buffer;
import static org.apache.commons.io.IOUtils.closeQuietly;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.sleep;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.waitfor;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.sleep;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.waitfor;
import static uk.ac.manchester.spinnaker.nmpi.machinemanager.responses.JobState.DESTROYED;
import static uk.ac.manchester.spinnaker.nmpi.machinemanager.responses.JobState.READY;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerCompat.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerCompat.java
index 8c3f2fd274..0fea614cec 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerCompat.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerCompat.java
@@ -18,7 +18,7 @@
import static java.util.Objects.nonNull;
import static org.joda.time.DateTimeZone.UTC;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.sleep;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.sleep;
import java.io.IOException;
import java.io.PrintWriter;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerV3.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerV3.java
index 27055ca4dc..00e8bac556 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerV3.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/nmpi/NMPIQueueManagerV3.java
@@ -18,7 +18,7 @@
import static java.util.Objects.nonNull;
import static org.joda.time.DateTimeZone.UTC;
import static org.slf4j.LoggerFactory.getLogger;
-import static uk.ac.manchester.spinnaker.nmpi.ThreadUtils.sleep;
+import static uk.ac.manchester.spinnaker.utils.ThreadUtils.sleep;
import java.io.IOException;
import java.io.PrintWriter;
diff --git a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/package-info.java b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/package-info.java
index 26a25a383a..92d265b898 100644
--- a/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/package-info.java
+++ b/SpiNNaker-nmpiserv/src/main/java/uk/ac/manchester/spinnaker/nmpi/package-info.java
@@ -15,5 +15,28 @@
*/
/**
* The NMPI service classes.
+ *
+ * The actual key service APIs are:
+ *
+ * - {@link NMPIQueueManager} — Handles the queue of {@linkplain Job
+ * NMPI jobs}.
+ *
- {@link JobExecuter} — Handles the running of a single NMPI job.
+ * Note that job executer implementations ask the queue manager for the job that
+ * they should run.
+ *
- {@link JobExecuterFactory} — Creates job executers.
+ *
- {@link MachineManager} — Handles the resources on which NMPI jobs
+ * run.
+ *
*/
+@UsedInJavadocOnly({
+ Job.class, JobExecuter.class, JobExecuterFactory.class,
+ MachineManager.class, NMPIQueueManager.class
+})
package uk.ac.manchester.spinnaker.nmpi;
+
+import uk.ac.manchester.spinnaker.nmpi.jobmanager.JobExecuter;
+import uk.ac.manchester.spinnaker.nmpi.jobmanager.JobExecuterFactory;
+import uk.ac.manchester.spinnaker.nmpi.machinemanager.MachineManager;
+import uk.ac.manchester.spinnaker.nmpi.model.job.nmpi.Job;
+import uk.ac.manchester.spinnaker.nmpi.nmpi.NMPIQueueManager;
+import uk.ac.manchester.spinnaker.utils.UsedInJavadocOnly;
diff --git a/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/ThreadUtils.java b/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/ThreadUtils.java
index d6d4729aec..9be89b3a81 100644
--- a/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/ThreadUtils.java
+++ b/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/ThreadUtils.java
@@ -25,6 +25,10 @@
* Utilities for working with threads.
*/
public abstract class ThreadUtils {
+ /** Avoid creation. */
+ private ThreadUtils() {
+ }
+
/**
* Produce a dump of what all threads are doing. Useful for debugging as it
* means you can get a dump of threads programmatically at the time when the
@@ -36,4 +40,55 @@ public static String threadDump() {
return stream(getThreadMXBean().dumpAllThreads(true, true))
.map(ThreadInfo::toString).collect(joining());
}
+
+ /**
+ * Recommended way of doing "quiet" sleeps.
+ *
+ * @param delay
+ * How long to sleep for, in milliseconds.
+ * @see Stack Overflow
+ * Question: When does Java's Thread.sleep throw
+ * InterruptedException?
+ */
+ public static void sleep(final long delay) {
+ try {
+ Thread.sleep(delay);
+ } catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ /**
+ * Wait for the given object.
+ *
+ * @param obj
+ * The object to wait for
+ * @return True if the wait was interrupted, false otherwise
+ */
+ public static boolean waitfor(final Object obj) {
+ try {
+ obj.wait();
+ return false;
+ } catch (final InterruptedException e) {
+ return true;
+ }
+ }
+
+ /**
+ * Wait for the given object.
+ *
+ * @param obj
+ * The object to wait for
+ * @param timeout
+ * The maximum time to wait, in milliseconds
+ * @return True if the wait was interrupted, false otherwise
+ */
+ public static boolean waitfor(final Object obj, final long timeout) {
+ try {
+ obj.wait(timeout);
+ return false;
+ } catch (final InterruptedException e) {
+ return true;
+ }
+ }
}
diff --git a/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/UsedInJavadocOnly.java b/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/UsedInJavadocOnly.java
index 58487f86dd..2dc561d5c8 100644
--- a/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/UsedInJavadocOnly.java
+++ b/SpiNNaker-utils/src/main/java/uk/ac/manchester/spinnaker/utils/UsedInJavadocOnly.java
@@ -18,6 +18,7 @@
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
@@ -32,7 +33,7 @@
* @author Donal Fellows
*/
@Retention(SOURCE)
-@Target({ TYPE, METHOD, CONSTRUCTOR, FIELD })
+@Target({ TYPE, METHOD, CONSTRUCTOR, FIELD, PACKAGE })
public @interface UsedInJavadocOnly {
/**
* Class or classes just used by the annotated thing in Javadoc generation.