aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-12-28 23:09:40 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-14 21:01:16 -0800
commitc1121777969fc5f183e325ad672b581cbe881895 (patch)
tree8d874f0244ceb68c7bc9f440f44b20cca882fdad /src/main/java/org/traccar/ServerManager.java
parent839751e76e329adb573150644bd6198beba0d3b6 (diff)
downloadtrackermap-server-c1121777969fc5f183e325ad672b581cbe881895.tar.gz
trackermap-server-c1121777969fc5f183e325ad672b581cbe881895.tar.bz2
trackermap-server-c1121777969fc5f183e325ad672b581cbe881895.zip
Extract connector interface
Diffstat (limited to 'src/main/java/org/traccar/ServerManager.java')
-rw-r--r--src/main/java/org/traccar/ServerManager.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/ServerManager.java b/src/main/java/org/traccar/ServerManager.java
index 935a821aa..45ac656f3 100644
--- a/src/main/java/org/traccar/ServerManager.java
+++ b/src/main/java/org/traccar/ServerManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 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.
@@ -39,7 +39,7 @@ public class ServerManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerManager.class);
- private final List<TrackerServer> serverList = new LinkedList<>();
+ private final List<TrackerConnector> connectorList = new LinkedList<>();
private final Map<String, BaseProtocol> protocolList = new ConcurrentHashMap<>();
private void loadPackage(String packageName) throws IOException, URISyntaxException, ReflectiveOperationException {
@@ -75,7 +75,7 @@ public class ServerManager {
if (BaseProtocol.class.isAssignableFrom(protocolClass) && Context.getConfig().hasKey(
Keys.PROTOCOL_PORT.withPrefix(BaseProtocol.nameFromClass(protocolClass)))) {
BaseProtocol protocol = (BaseProtocol) protocolClass.getDeclaredConstructor().newInstance();
- serverList.addAll(protocol.getServerList());
+ connectorList.addAll(protocol.getConnectorList());
protocolList.put(protocol.getName(), protocol);
}
}
@@ -90,18 +90,18 @@ public class ServerManager {
}
public void start() throws Exception {
- for (TrackerServer server: serverList) {
+ for (TrackerConnector connector: connectorList) {
try {
- server.start();
+ connector.start();
} catch (BindException e) {
- LOGGER.warn("Port {} is disabled due to conflict", server.getPort());
+ LOGGER.warn("Port disabled due to conflict", e);
}
}
}
public void stop() {
- for (TrackerServer server: serverList) {
- server.stop();
+ for (TrackerConnector connector: connectorList) {
+ connector.stop();
}
GlobalTimer.release();
}