+5
-8
src/main/java/com/github/puregero/minecraftstresstest/MinecraftStressTest.java
+5
-8
src/main/java/com/github/puregero/minecraftstresstest/MinecraftStressTest.java
···
97
97
98
98
private static void removeBotsIfNeeded() {
99
99
botsLock.lock();
100
-
while (true) {
100
+
try {
101
101
Bot removedBot;
102
-
try {
103
-
if (bots.size() <= BOT_COUNT) {
104
-
break;
105
-
}
102
+
while (bots.size() > BOT_COUNT) {
106
103
removedBot = bots.remove(bots.size() - 1);
107
-
} finally {
108
-
botsLock.unlock();
104
+
removedBot.close();
109
105
}
110
-
removedBot.close();
106
+
} finally {
107
+
botsLock.unlock();
111
108
}
112
109
}
113
110