ptupitsyn commented on code in PR #11003:
URL: https://github.com/apache/ignite/pull/11003#discussion_r1376025596


##########
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java:
##########
@@ -281,6 +344,96 @@ else if 
(ch.clientChannel().protocolCtx().isFeatureSupported(ProtocolBitmaskFeat
         }
     }
 
+    /**
+     * Asynchronously requests the service topology if the partition awareness 
is enabled and if the update is requred.
+     *
+     * @param srvcTop If not {@code null}, uses this service topology record 
and ignores {@code name}.
+     * @param name If {@code srvTop} is {@code null}, gets service topology 
record by this name.
+     * @see #needUpdateSrvcTop(ServiceTopology, AffinityTopologyVersion)
+     */
+    private void tryRequestServiceTopology(@Nullable ServiceTopology srvcTop, 
String name) {
+        if (srvcTop == null) {
+            srvcTop = servicesTopologies.compute(name, (nm, t) -> {
+                if (t == null)
+                    t = new ServiceTopology();
+
+                return t;
+            });
+        }
+
+        ServiceTopology srvcTop0 = srvcTop;
+
+        AffinityTopologyVersion curAffTop = 
ch.affinityContext().lastTopology().version();
+
+        if (!needUpdateSrvcTop(srvcTop0, curAffTop))
+            return;
+
+        ForkJoinPool.commonPool().execute(() -> {
+            Throwable t = null;
+
+            try {
+                if (log.isDebugEnabled())
+                    log.debug("Requesting service topology update for the 
service '" + name + "' ...");
+
+                List<UUID> nodes = ch.service(
+                    ClientOperation.SERVICE_GET_TOPOLOGY,
+                    req -> {
+                        if 
(!req.clientChannel().protocolCtx().isFeatureSupported(ProtocolBitmaskFeature.SERVICE_TOPOLOGY))
+                            throw new 
ClientFeatureNotSupportedByServerException(ProtocolBitmaskFeature.SERVICE_TOPOLOGY);

Review Comment:
   Using `applyOnDefaultChannel` to check for a feature does not prevent us 
from using `serviceAsync`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to