mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Close the main selector
This commit is contained in:
parent
8895e49a52
commit
0d91f9efc6
@ -24,6 +24,7 @@ public class Server {
|
||||
|
||||
private volatile boolean stop;
|
||||
|
||||
private final Selector selector = Selector.open();
|
||||
private final List<Worker> workers = new ArrayList<>(WORKER_COUNT);
|
||||
private int index;
|
||||
|
||||
@ -39,7 +40,6 @@ public class Server {
|
||||
}
|
||||
|
||||
public void start(SocketAddress address) throws IOException {
|
||||
Selector selector = Selector.open();
|
||||
this.serverSocket = ServerSocketChannel.open();
|
||||
serverSocket.bind(address);
|
||||
serverSocket.configureBlocking(false);
|
||||
@ -65,6 +65,7 @@ public class Server {
|
||||
|
||||
public void stop() {
|
||||
this.stop = true;
|
||||
this.selector.wakeup();
|
||||
this.workers.forEach(worker -> worker.selector.wakeup());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user