mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-02-09 13:08:50 -06:00
Fix some thread safety issues due to not using thread safe list
This commit is contained in:
@@ -11,9 +11,9 @@ import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* @author NovaFox161
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
@SuppressWarnings("Duplicates")
|
||||
@Component
|
||||
public class NetworkInfo {
|
||||
private final List<ConnectedClient> clients = new ArrayList<>();
|
||||
private final List<ConnectedClient> clients = new CopyOnWriteArrayList<>();
|
||||
|
||||
private int calCount;
|
||||
private int announcementCount;
|
||||
@@ -46,7 +46,7 @@ public class NetworkInfo {
|
||||
|
||||
//Getters
|
||||
public List<ConnectedClient> getClients() {
|
||||
return new ArrayList<>(this.clients);
|
||||
return new CopyOnWriteArrayList<>(this.clients);
|
||||
}
|
||||
|
||||
public boolean doesClientExist(final int clientIndex) {
|
||||
|
||||
Reference in New Issue
Block a user