Cleaned up server run logic.
This commit is contained in:
parent
e9fa0c13a7
commit
2759097ef6
|
@ -184,7 +184,7 @@ public class ConcordServer implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
this.running = true;
|
this.running = true;
|
||||||
this.scheduledExecutorService.scheduleAtFixedRate(this::publishMetaDataToDiscoveryServers, 1, 1, TimeUnit.MINUTES);
|
this.scheduledExecutorService.scheduleAtFixedRate(this::publishMetaDataToDiscoveryServers, 0, 1, TimeUnit.MINUTES);
|
||||||
ServerSocket serverSocket;
|
ServerSocket serverSocket;
|
||||||
try {
|
try {
|
||||||
serverSocket = new ServerSocket(this.config.getPort());
|
serverSocket = new ServerSocket(this.config.getPort());
|
||||||
|
@ -195,13 +195,18 @@ public class ConcordServer implements Runnable {
|
||||||
}
|
}
|
||||||
System.out.println(startupMessage);
|
System.out.println(startupMessage);
|
||||||
while (this.running) {
|
while (this.running) {
|
||||||
|
try {
|
||||||
Socket socket = serverSocket.accept();
|
Socket socket = serverSocket.accept();
|
||||||
ClientThread clientThread = new ClientThread(socket, this);
|
ClientThread clientThread = new ClientThread(socket, this);
|
||||||
clientThread.start();
|
clientThread.start();
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
serverSocket.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Could not open server socket: " + e.getMessage());
|
||||||
|
}
|
||||||
this.scheduledExecutorService.shutdown();
|
this.scheduledExecutorService.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue