aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/Main.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-04-30 18:29:37 -0700
committerAnton Tananaev <anton@traccar.org>2022-04-30 18:29:37 -0700
commit2a6e75c5d9527cb7b5b54e257fd756e717d5347a (patch)
tree9d8bd9d7302953ce4d65e458f1dd72be92e2c26b /src/main/java/org/traccar/Main.java
parent94fa65d6961fc369923b11a60758b83ac7c3ecae (diff)
downloadtrackermap-server-2a6e75c5d9527cb7b5b54e257fd756e717d5347a.tar.gz
trackermap-server-2a6e75c5d9527cb7b5b54e257fd756e717d5347a.tar.bz2
trackermap-server-2a6e75c5d9527cb7b5b54e257fd756e717d5347a.zip
Implement cluster broadcasting
Diffstat (limited to 'src/main/java/org/traccar/Main.java')
-rw-r--r--src/main/java/org/traccar/Main.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/Main.java b/src/main/java/org/traccar/Main.java
index 6daf72bb4..2eaf394af 100644
--- a/src/main/java/org/traccar/Main.java
+++ b/src/main/java/org/traccar/Main.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,13 +118,14 @@ public final class Main {
List<LifecycleObject> services = new LinkedList<>();
services.add(Context.getServerManager());
- if (Context.getWebServer() != null) {
- services.add(Context.getWebServer());
- }
+ services.add(Context.getWebServer());
services.add(Context.getScheduleManager());
+ services.add(Context.getBroadcastService());
for (LifecycleObject service : services) {
- service.start();
+ if (service != null) {
+ service.start();
+ }
}
Thread.setDefaultUncaughtExceptionHandler((t, e) -> LOGGER.error("Thread exception", e));
@@ -134,7 +135,9 @@ public final class Main {
Collections.reverse(services);
for (LifecycleObject service : services) {
- service.stop();
+ if (service != null) {
+ service.stop();
+ }
}
}));
} catch (Exception e) {