100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Removed unused Camel dependencies, clean shutdown for syslog service
Christian Bauerd6d85ef72167
diff --git a/container/build.gradle b/container/build.gradleindex 8befe2c60..8aeab5a69 100644--- a/container/build.gradle+++ b/container/build.gradle@@ -45,8 +45,6 @@ dependencies {compile "org.apache.camel:camel-core:$camelVersion"compile "org.apache.camel:camel-jackson:$camelVersion"- compile "org.apache.camel:camel-script:$camelVersion"- compile "org.apache.camel:camel-groovy:$camelVersion"compile("com.fasterxml.uuid:java-uuid-generator:$uuidGeneratorVersion") {exclude group: "log4j"diff --git a/manager/src/main/java/org/openremote/manager/syslog/SyslogService.java b/manager/src/main/java/org/openremote/manager/syslog/SyslogService.javaindex a6ffc417a..e678934ec 100644--- a/manager/src/main/java/org/openremote/manager/syslog/SyslogService.java+++ b/manager/src/main/java/org/openremote/manager/syslog/SyslogService.java@@ -34,6 +34,7 @@ import java.util.ArrayList;import java.util.Arrays;import java.util.Collections;import java.util.List;+import java.util.concurrent.ScheduledFuture;import java.util.logging.Handler;import java.util.logging.LogRecord;import java.util.logging.Logger;@@ -53,6 +54,8 @@ public class SyslogService extends Handler implements ContainerService {protected SyslogConfig config;final protected List<SyslogEvent> batch = new ArrayList<>();+ protected ScheduledFuture flushBatchFuture;+ protected ScheduledFuture deleteOldFuture;@Overridepublic void init(Container container) throws Exception {@@ -89,10 +92,10 @@ public class SyslogService extends Handler implements ContainerService {public void start(Container container) throws Exception {if (persistenceService != null) {// Flush batch every 3 seconds (wait 10 seconds for database (schema) to be ready in dev mode)- executorService.scheduleAtFixedRate(this::flushBatch, 10 * 1000, 3 * 1000);+ flushBatchFuture = executorService.scheduleAtFixedRate(this::flushBatch, 10 * 1000, 3 * 1000);// Clear outdated events every minute- executorService.scheduleAtFixedRate(() -> {+ deleteOldFuture = executorService.scheduleAtFixedRate(() -> {// Not ready on startupif (persistenceService.getEntityManagerFactory() == null)return;@@ -112,6 +115,14 @@ public class SyslogService extends Handler implements ContainerService {@Overridepublic void stop(Container container) throws Exception {+ if (flushBatchFuture != null) {+ flushBatchFuture.cancel(true);+ flushBatchFuture = null;+ }+ if (deleteOldFuture != null) {+ deleteOldFuture.cancel(true);+ deleteOldFuture = null;+ }}@Override