Added config for TcpSocketServer port.
This commit is contained in:
parent
f1bc3c7b0a
commit
e1a756ffc9
|
@ -6,6 +6,7 @@ import nl.andrewl.railsignalapi.live.ComponentUplinkMessageHandler;
|
||||||
import nl.andrewl.railsignalapi.model.LinkToken;
|
import nl.andrewl.railsignalapi.model.LinkToken;
|
||||||
import nl.andrewl.railsignalapi.service.LinkTokenService;
|
import nl.andrewl.railsignalapi.service.LinkTokenService;
|
||||||
import nl.andrewl.railsignalapi.util.JsonUtils;
|
import nl.andrewl.railsignalapi.util.JsonUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.event.ContextClosedEvent;
|
import org.springframework.context.event.ContextClosedEvent;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
|
@ -43,6 +44,9 @@ public class TcpSocketServer {
|
||||||
private final ServerSocket serverSocket;
|
private final ServerSocket serverSocket;
|
||||||
private final Set<TcpLinkManager> linkManagers;
|
private final Set<TcpLinkManager> linkManagers;
|
||||||
|
|
||||||
|
@Value("${rail-signal.live.tcp.port}")
|
||||||
|
private int port;
|
||||||
|
|
||||||
private final LinkTokenService tokenService;
|
private final LinkTokenService tokenService;
|
||||||
private final ComponentDownlinkService componentDownlinkService;
|
private final ComponentDownlinkService componentDownlinkService;
|
||||||
private final ComponentUplinkMessageHandler uplinkMessageHandler;
|
private final ComponentUplinkMessageHandler uplinkMessageHandler;
|
||||||
|
@ -59,13 +63,13 @@ public class TcpSocketServer {
|
||||||
this.linkManagers = new HashSet<>();
|
this.linkManagers = new HashSet<>();
|
||||||
this.serverSocket = new ServerSocket();
|
this.serverSocket = new ServerSocket();
|
||||||
serverSocket.setReuseAddress(true);
|
serverSocket.setReuseAddress(true);
|
||||||
serverSocket.bind(new InetSocketAddress("localhost", 8081));
|
serverSocket.bind(new InetSocketAddress("localhost", port));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
public void runServer() {
|
public void runServer() {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
log.info("Starting TCP Socket for Component links at " + serverSocket.getInetAddress());
|
log.info("Starting TCP Socket for Component links at " + serverSocket.getInetAddress() + ":" + port);
|
||||||
while (!serverSocket.isClosed()) {
|
while (!serverSocket.isClosed()) {
|
||||||
try {
|
try {
|
||||||
Socket socket = serverSocket.accept();
|
Socket socket = serverSocket.accept();
|
||||||
|
|
|
@ -5,7 +5,11 @@ spring.jpa.open-in-view=false
|
||||||
spring.datasource.hikari.maximum-pool-size=5
|
spring.datasource.hikari.maximum-pool-size=5
|
||||||
spring.datasource.hikari.minimum-idle=1
|
spring.datasource.hikari.minimum-idle=1
|
||||||
|
|
||||||
|
spring.thymeleaf.enabled=false
|
||||||
|
|
||||||
server.port=8080
|
server.port=8080
|
||||||
server.tomcat.threads.max=10
|
server.tomcat.threads.max=10
|
||||||
server.tomcat.threads.min-spare=2
|
server.tomcat.threads.min-spare=2
|
||||||
server.tomcat.processor-cache=50
|
server.tomcat.processor-cache=50
|
||||||
|
|
||||||
|
rail-signal.live.tcp.port=8081
|
||||||
|
|
Loading…
Reference in New Issue