@@ -65,6 +65,7 @@ public class LimitlessRouterMonitor implements AutoCloseable, Runnable {
6565 private final AtomicReference <List <HostSpec >> limitlessRouters ;
6666 private final @ NonNull Properties props ;
6767 private final @ NonNull PluginService pluginService ;
68+ protected final LimitlessQueryHelper queryHelper ;
6869 private final TelemetryFactory telemetryFactory ;
6970 private Connection monitoringConn = null ;
7071 final Executor networkTimeoutExecutor = new SynchronousExecutor ();
@@ -89,7 +90,6 @@ public LimitlessRouterMonitor(
8990 this .limitlessRouterEndpointQuery = getLimitlessRouterEndpointQuery ();
9091 this .limitlessRouters = new AtomicReference <>(limitlessRouters );
9192 this .props = PropertyUtils .copyProperties (props );
92-
9393 props .stringPropertyNames ().stream ()
9494 .filter (p -> p .startsWith (MONITORING_PROPERTY_PREFIX ))
9595 .forEach (
@@ -103,7 +103,7 @@ public LimitlessRouterMonitor(
103103
104104 this .intervalMs = intervalMs ;
105105 this .telemetryFactory = this .pluginService .getTelemetryFactory ();
106-
106+ this . queryHelper = new LimitlessQueryHelper ( this . pluginService );
107107 this .threadPool .submit (this );
108108 this .threadPool .shutdown (); // No more task are accepted by pool.
109109 }
@@ -153,7 +153,8 @@ public void run() {
153153 if (this .monitoringConn == null || this .monitoringConn .isClosed ()) {
154154 continue ;
155155 }
156- List <HostSpec > newLimitlessRouters = queryForLimitlessRouters (this .monitoringConn );
156+ List <HostSpec > newLimitlessRouters = queryHelper .queryForLimitlessRouters (this .monitoringConn ,
157+ this .hostSpec .getPort ());
157158 this .limitlessRouters .set (Collections .unmodifiableList (newLimitlessRouters ));
158159 RoundRobinHostSelector .setRoundRobinHostWeightPairsProperty (this .props , newLimitlessRouters );
159160 LOGGER .finest (Utils .logTopology (limitlessRouters .get (), "[limitlessRouterMonitor]" ));
@@ -190,7 +191,8 @@ public List<HostSpec> forceGetLimitlessRouters() throws SQLException {
190191 if (this .monitoringConn == null || this .monitoringConn .isClosed ()) {
191192 throw new SQLException (Messages .get ("LimitlessRouterMonitor.forceGetLimitlessRoutersFailed" ));
192193 }
193- List <HostSpec > newLimitlessRouters = queryForLimitlessRouters (this .monitoringConn );
194+ List <HostSpec > newLimitlessRouters = queryHelper .queryForLimitlessRouters (this .monitoringConn ,
195+ this .hostSpec .getPort ());
194196 this .limitlessRouters .set (Collections .unmodifiableList (newLimitlessRouters ));
195197 RoundRobinHostSelector .setRoundRobinHostWeightPairsProperty (this .props , newLimitlessRouters );
196198 LOGGER .finest (Utils .logTopology (limitlessRouters .get (), "[limitlessRouterMonitor]" ));
0 commit comments