Added takefromcommandqueue methods, removed throws and made internal to function

This commit is contained in:
Bas de Jong
2025-09-18 15:20:34 +02:00
parent a6e97c5070
commit 5fc3bddca8

View File

@@ -43,8 +43,20 @@ public class TicTacToe extends GameBase implements Runnable {
commandQueue.add(command);
}
private void addSendToQueue(String send) throws InterruptedException {
sendQueue.put(send);
private void takeFromCommandQueue() {
try {
ParsedCommand cmd = this.commandQueue.take();
} catch (InterruptedException e) {
logger.error("Taking from queue interrupted, in game with id: {}", this.gameId);
}
}
private void addSendToQueue(String send) {
try {
sendQueue.put(send);
} catch (InterruptedException e) {
logger.error("Sending to queue interrupted, in game with id: {}", this.gameId);
}
}
@Override