mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-12 14:58:26 +02:00
ConnectionSystem cached values now cleared
This commit is contained in:
parent
ad739ffc8f
commit
db47e51e45
@ -178,5 +178,20 @@ public class WorldTable extends Table {
|
||||
return column;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof WorldTable)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
WorldTable that = (WorldTable) o;
|
||||
return Objects.equals(statementSelectID, that.statementSelectID) &&
|
||||
Objects.equals(serverTable, that.serverTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), statementSelectID, serverTable);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,8 +286,8 @@ public class WorldTimesTable extends UserIDTable {
|
||||
public void addWorldTimesToSessions(Map<UUID, Map<UUID, List<Session>>> map) {
|
||||
Map<Integer, WorldTimes> worldTimesBySessionID = getAllWorldTimesBySessionID();
|
||||
|
||||
for (UUID serverUUID : map.keySet()) {
|
||||
for (List<Session> sessions : map.get(serverUUID).values()) {
|
||||
for (Map.Entry<UUID, Map<UUID, List<Session>>> entry : map.entrySet()) {
|
||||
for (List<Session> sessions : entry.getValue().values()) {
|
||||
for (Session session : sessions) {
|
||||
WorldTimes worldTimes = worldTimesBySessionID.get(session.getUnsafe(SessionKeys.DB_ID));
|
||||
if (worldTimes != null) {
|
||||
@ -377,4 +377,21 @@ public class WorldTimesTable extends UserIDTable {
|
||||
return column;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof WorldTimesTable)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
WorldTimesTable that = (WorldTimesTable) o;
|
||||
return Objects.equals(serverTable, that.serverTable) &&
|
||||
Objects.equals(worldTable, that.worldTable) &&
|
||||
Objects.equals(sessionsTable, that.sessionsTable) &&
|
||||
Objects.equals(insertStatement, that.insertStatement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), serverTable, worldTable, sessionsTable, insertStatement);
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,6 @@ public class FileSystem implements SubSystem {
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
// No disable actions necessary.
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,6 @@ public abstract class InfoSystem implements SubSystem {
|
||||
Server bungee = new Server(-1, null, "Bungee", addressToRequestServer, -1);
|
||||
String addressOfThisServer = WebServerSystem.getInstance().getWebServer().getAccessAddress();
|
||||
|
||||
ConnectionSystem connectionSystem = ConnectionSystem.getInstance();
|
||||
connectionSystem.setSetupAllowed(true);
|
||||
connectionSystem.sendInfoRequest(new SendDBSettingsRequest(addressOfThisServer), bungee);
|
||||
}
|
||||
|
@ -14,9 +14,7 @@ import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* ConnectionSystem for Bungee.
|
||||
@ -59,20 +57,6 @@ public class BungeeConnectionSystem extends ConnectionSystem {
|
||||
return server;
|
||||
}
|
||||
|
||||
private Server getOneBukkitServer() {
|
||||
int rand = ThreadLocalRandom.current().nextInt(bukkitServers.size());
|
||||
int i = 0;
|
||||
for (Server server : bukkitServers.values()) {
|
||||
if (i == rand) {
|
||||
return server;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
// Fallback if code above fails (Shouldn't)
|
||||
Optional<Server> first = bukkitServers.values().stream().findAny();
|
||||
return first.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendWideInfoRequest(WideRequest infoRequest) throws NoServersException {
|
||||
refreshServerMap();
|
||||
@ -99,8 +83,4 @@ public class BungeeConnectionSystem extends ConnectionSystem {
|
||||
refreshServerMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -111,4 +111,11 @@ public abstract class ConnectionSystem implements SubSystem {
|
||||
public List<Server> getBukkitServers() {
|
||||
return new ArrayList<>(bukkitServers.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
setupAllowed = false;
|
||||
bukkitServers.clear();
|
||||
dataRequests.clear();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user