From 680702316f46fb067ca4a862b2f061c346cad5f1 Mon Sep 17 00:00:00 2001 From: Nathaniel Date: Thu, 26 Oct 2023 17:51:30 -0600 Subject: [PATCH] remove connection --- buildSrc/src/main/groovy/nucleodb.app.gradle | 2 +- buildSrc/src/main/groovy/nucleodb.library.gradle | 2 +- .../database/tables/ConnectionHandler.java | 15 +++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/buildSrc/src/main/groovy/nucleodb.app.gradle b/buildSrc/src/main/groovy/nucleodb.app.gradle index bf4fec3..367652d 100644 --- a/buildSrc/src/main/groovy/nucleodb.app.gradle +++ b/buildSrc/src/main/groovy/nucleodb.app.gradle @@ -3,7 +3,7 @@ plugins { } group = 'com.nucleodb' -version = '1.7.3' +version = '1.7.4' repositories { mavenCentral() diff --git a/buildSrc/src/main/groovy/nucleodb.library.gradle b/buildSrc/src/main/groovy/nucleodb.library.gradle index da5d48e..cd3a318 100644 --- a/buildSrc/src/main/groovy/nucleodb.library.gradle +++ b/buildSrc/src/main/groovy/nucleodb.library.gradle @@ -3,7 +3,7 @@ plugins { } group = 'com.nucleodb' -version = '1.9.3' +version = '1.9.4' repositories { mavenCentral() diff --git a/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java b/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java index df0ec9f..129598d 100644 --- a/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java +++ b/library/src/main/java/com/nucleocore/library/database/tables/ConnectionHandler.java @@ -203,14 +203,21 @@ private void addConnection(Connection connection){ this.putConnectionInKey(connection.getFromKey()+connection.getToKey()+connection.getLabel(), connection); allConnections.add(connection); } - private void removeConnection(Connection connection){ - connectionByUUID.remove(connection.getUuid()); - String key = connection.getFromKey(); + + private void removeByKey(String key, Connection connection){ if(connections.containsKey(key)){ - allConnections.remove(connection); connections.get(key).remove(connection); } } + + private void removeConnection(Connection connection){ + connectionByUUID.remove(connection.getUuid()); + String connectionKey = connection.getFromKey(); + this.removeByKey(connectionKey, connection); + this.removeByKey(connection.getFromKey()+connection.getLabel(), connection); + this.removeByKey(connection.getFromKey()+connection.getToKey()+connection.getLabel(), connection); + allConnections.remove(connection); + } public void consume() { if (this.config.getBootstrap() != null) { String consumer = UUID.randomUUID().toString();