aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-10-17 17:08:59 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-10-17 17:08:59 +1300
commit61d4c1f15b645aa06c84905933108437e1ade92a (patch)
tree33ca5e2e7d262c6941d66a6c23ff37c2c32e7a8f /src/org/traccar/ServerManager.java
parentae32084f88df4436e1a2cdcb346ff1e7e286e369 (diff)
downloadtrackermap-server-61d4c1f15b645aa06c84905933108437e1ade92a.tar.gz
trackermap-server-61d4c1f15b645aa06c84905933108437e1ade92a.tar.bz2
trackermap-server-61d4c1f15b645aa06c84905933108437e1ade92a.zip
Move server init into constructor
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r--src/org/traccar/ServerManager.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 17c572ae3..cdc679e8a 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -70,10 +70,11 @@ public class ServerManager {
for (String name : names) {
Class protocolClass = Class.forName(packageName + '.' + name);
- if (BaseProtocol.class.isAssignableFrom(protocolClass)) {
- BaseProtocol baseProtocol = (BaseProtocol) protocolClass.newInstance();
- initProtocolServer(baseProtocol);
- protocolList.put(baseProtocol.getName(), baseProtocol);
+ if (BaseProtocol.class.isAssignableFrom(protocolClass)
+ && Context.getConfig().hasKey(BaseProtocol.nameFromClass(protocolClass) + ".port")) {
+ BaseProtocol protocol = (BaseProtocol) protocolClass.newInstance();
+ serverList.addAll(protocol.getServerList());
+ protocolList.put(protocol.getName(), protocol);
}
}
}
@@ -99,10 +100,4 @@ public class ServerManager {
GlobalTimer.release();
}
- private void initProtocolServer(final Protocol protocol) {
- if (Context.getConfig().hasKey(protocol.getName() + ".port")) {
- protocol.initTrackerServers(serverList);
- }
- }
-
}