From 5fc3bddca8a5596e3068b8baaaf23e778dab6249 Mon Sep 17 00:00:00 2001 From: Bas de Jong Date: Thu, 18 Sep 2025 15:20:34 +0200 Subject: [PATCH] Added takefromcommandqueue methods, removed throws and made internal to function --- .../java/org/toop/game/tictactoe/TicTacToe.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/toop/game/tictactoe/TicTacToe.java b/src/main/java/org/toop/game/tictactoe/TicTacToe.java index 127f535..5914fbd 100644 --- a/src/main/java/org/toop/game/tictactoe/TicTacToe.java +++ b/src/main/java/org/toop/game/tictactoe/TicTacToe.java @@ -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