Synchronize around the wait call that keeps the service running.

This commit is contained in:
Mark Milligan 2022-11-17 17:21:36 -06:00
parent bf648f069c
commit 95a554422d
2 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>lantern-currentmonitor</artifactId>
<packaging>jar</packaging>
<version>1.1.2</version>
<version>1.1.3</version>
<name>lantern-currentmonitor</name>
<parent>

View File

@ -301,12 +301,14 @@ public class MonitorApp {
monitor.stop();
pool.shutdown();
}, "Monitor Shutdown"));
synchronized (monitor) {
try {
monitor.wait();
} catch (InterruptedException _e) {
LOG.error("Interrupted, shutting down", _e);
}
}
}
private static final class PowerPoster implements Runnable {
private final long firstPost;