vldpyatkov commented on code in PR #4730:
URL: https://github.com/apache/ignite-3/pull/4730#discussion_r1846078959


##########
modules/client/src/main/java/org/apache/ignite/internal/client/ClientTimeoutWorker.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.client;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static 
org.apache.ignite.internal.util.FastTimestamps.coarseCurrentTimeMillis;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import org.apache.ignite.internal.future.timeout.TimeoutWorker;
+import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.internal.thread.NamedThreadFactory;
+import org.jetbrains.annotations.Nullable;
+
+final class ClientTimeoutWorker {
+    static final ClientTimeoutWorker INSTANCE = new ClientTimeoutWorker();
+
+    private static final int emptyCountThreshold = 10;
+
+    private @Nullable ScheduledExecutorService executor = null;
+
+    private final Map<TcpClientChannel, TcpClientChannel> channels = new 
ConcurrentHashMap<>();

Review Comment:
   Better to use something like a concurrent hash set, for example, this:
   `ConcurrentHashMap.newKeySet()`



##########
modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java:
##########
@@ -159,17 +154,6 @@ private TcpClientChannel(
 
         log = ClientUtils.logger(cfg.clientConfiguration(), 
TcpClientChannel.class);
 
-        this.timeoutWorker = new TimeoutWorker(
-                log,
-                cfg.getAddress().getHostString() + cfg.getAddress().getPort(),
-                "TcpClientChannel-timeout-worker",
-                pendingReqs,
-                // Client-facing future will fail with a timeout, but internal 
ClientRequestFuture will stay in the map -
-                // otherwise we'll fail with "protocol breakdown" error when a 
late response arrives from the server.
-                false,

Review Comment:
   May be you will remove this flag from the common timeout worker because it 
was written for the client and now it is useless.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to