fix packet queue bug, name threads

This commit is contained in:
Bixilon 2020-06-24 17:53:16 +02:00
parent 1b13b4981b
commit 6d1a7052ae
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 6 additions and 2 deletions

View File

@ -69,6 +69,7 @@ public class Log {
} }
}); });
logThread.setName("Log-Thread");
logThread.start(); logThread.start();
} }

View File

@ -164,7 +164,7 @@ public class Connection {
private void startHandlingThread() { private void startHandlingThread() {
handleThread = new Thread(() -> { handleThread = new Thread(() -> {
while (getConnectionState() != ConnectionState.DISCONNECTED) { while (getConnectionState() != ConnectionState.DISCONNECTING) {
while (handlingQueue.size() > 0) { while (handlingQueue.size() > 0) {
try { try {
handlingQueue.get(0).log(); handlingQueue.get(0).log();
@ -182,6 +182,7 @@ public class Connection {
} }
} }
}); });
handleThread.setName("Handle-Thread");
handleThread.start(); handleThread.start();
} }

View File

@ -119,6 +119,7 @@ public class Network {
e.printStackTrace(); e.printStackTrace();
} }
}); });
socketThread.setName("Socket-Thread");
socketThread.start(); socketThread.start();
} }
@ -129,7 +130,7 @@ public class Network {
// sleep 1 ms // sleep 1 ms
packetThread = new Thread(() -> { packetThread = new Thread(() -> {
// compressed data, makes packets to binary data // compressed data, makes packets to binary data
while (connection.getConnectionState() != ConnectionState.DISCONNECTED) { while (connection.getConnectionState() != ConnectionState.DISCONNECTING) {
while (queue.size() > 0) { while (queue.size() > 0) {
ServerboundPacket p = queue.get(0); ServerboundPacket p = queue.get(0);
@ -242,6 +243,7 @@ public class Network {
} }
}); });
packetThread.setName("Packet-Thread");
packetThread.start(); packetThread.start();
} }