isapego commented on a change in pull request #8206:
URL: https://github.com/apache/ignite/pull/8206#discussion_r482838479



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelHolder.java
##########
@@ -0,0 +1,149 @@
+/*
+ * 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.thin;
+
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import org.apache.ignite.client.ClientAuthenticationException;
+import org.apache.ignite.client.ClientConnectionException;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Channels holder.

Review comment:
       Please, add a description of what is this class for and how should it be 
used.

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelHolder.java
##########
@@ -0,0 +1,149 @@
+/*
+ * 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.thin;
+
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import org.apache.ignite.client.ClientAuthenticationException;
+import org.apache.ignite.client.ClientConnectionException;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Channels holder.
+ */
+class ClientChannelHolder {
+    /** Channel configuration. */
+    final ClientChannelConfiguration chCfg;
+
+    /** Channel. */
+    private volatile ClientChannel ch;
+
+    /** Address that holder is bind to (chCfg.addr) is not in use now. So 
close the holder */
+    private volatile boolean close;
+
+    /** Timestamps of reconnect retries. */
+    private final long[] reconnectRetries;
+
+    /** Channel factory. */
+    private final Function<ClientChannelConfiguration, ClientChannel> 
chFactory;
+
+    /** Callback invokes when new channel create */
+    private final BiConsumer<ClientChannelHolder, ClientChannel> 
onChannelCreate;
+
+    /** Callback invokes when channel close */
+    private final Consumer<ClientChannel> onChannelClose;
+
+    /**
+     * @param chCfg Channel config.
+     */
+    ClientChannelHolder(ClientChannelConfiguration chCfg,
+                        Function<ClientChannelConfiguration, ClientChannel> 
chFactory,
+                        BiConsumer<ClientChannelHolder, ClientChannel> 
onChannelCreate,
+                        Consumer<ClientChannel> onChannelClose) {
+        this.chCfg = chCfg;
+        this.chFactory = chFactory;
+        this.onChannelCreate = onChannelCreate;
+        this.onChannelClose = onChannelClose;
+
+        reconnectRetries = chCfg.getReconnectThrottlingRetries() > 0 && 
chCfg.getReconnectThrottlingPeriod() > 0L ?
+            new long[chCfg.getReconnectThrottlingRetries()] : null;
+    }
+
+    /**
+     * @return Whether reconnect throttling should be applied.
+     */
+    boolean applyReconnectionThrottling() {

Review comment:
       `private` here and for other methods where apply.

##########
File path: 
modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java
##########
@@ -115,18 +116,33 @@
     /** Reconnect throttling retries. See {@code reconnectThrottlingPeriod}. */
     private int reconnectThrottlingRetries = 3;
 
+    /**
+     * Try use other limited number of channels to send a request if default 
channel is not responding.
+     * 0 means try use all configured channels before fail.
+     */
+    private int channelsAttemptsLimit = 0;

Review comment:
       +1 for `retryLimit`




----------------------------------------------------------------
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.

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


Reply via email to