Skip to content

Commit

Permalink
fix: add RdsHostListProvider.getClusterId() to call init() in case of… (
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchung-bitquill authored Oct 23, 2024
1 parent faf104b commit 195b930
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ public interface HostListProvider {

HostSpec identifyConnection(Connection connection) throws SQLException;

String getClusterId() throws UnsupportedOperationException;
String getClusterId() throws UnsupportedOperationException, SQLException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ public HostSpec identifyConnection(Connection connection) throws SQLException {
}

@Override
public String getClusterId() throws UnsupportedOperationException {
public String getClusterId() throws UnsupportedOperationException, SQLException {
init();
return this.clusterId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import software.amazon.jdbc.AwsWrapperProperty;
import software.amazon.jdbc.HostSpec;
import software.amazon.jdbc.PluginService;
import software.amazon.jdbc.util.Messages;
import software.amazon.jdbc.util.SlidingExpirationCacheWithCleanupThread;
import software.amazon.jdbc.util.Utils;

public class LimitlessRouterServiceImpl implements LimitlessRouterService {
private static final Logger LOGGER =
Logger.getLogger(LimitlessRouterServiceImpl.class.getName());
public static final AwsWrapperProperty MONITOR_DISPOSAL_TIME_MS =
new AwsWrapperProperty(
"limitlessTransactionRouterMonitorDisposalTimeMs",
Expand Down Expand Up @@ -143,12 +147,13 @@ public void startMonitoring(final @NonNull HostSpec hostSpec,
.createLimitlessRouterMonitor(
hostSpec,
limitlessRouterCache,
this.pluginService.getHostListProvider().getClusterId(),
limitlessRouterMonitorKey,
props,
intervalMs),
cacheExpirationNano);
} catch (UnsupportedOperationException e) {
throw e;
} catch (SQLException e) {
LOGGER.warning(Messages.get("LimitlessRouterServiceImpl.errorStartingMonitor", new Object[]{e}));
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ LimitlessRouterMonitor.openedConnection=Opened Limitless Router Monitor connecti
LimitlessRouterMonitor.running=Limitless Router Monitor thread running on node {0}.
LimitlessRouterMonitor.stopped=Limitless Router Monitor thread stopped on node {0].

# Limitless Router Service
LimitlessRouterServiceImpl.errorStartingMonitor=An error occurred while starting Limitless Router Monitor. {0}

# Log Query Connection Plugin
LogQueryConnectionPlugin.executingQuery=[{0}] Executing query: {1}

Expand Down

0 comments on commit 195b930

Please sign in to comment.