timoninmaxim commented on a change in pull request #8206:
URL: https://github.com/apache/ignite/pull/8206#discussion_r483148056
##########
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.
Review comment:
fixed.
##########
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:
Outdated.
##########
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;
Review comment:
fixed.
##########
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:
fixed.
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java
##########
@@ -62,16 +65,16 @@
private final Function<ClientChannelConfiguration, ClientChannel>
chFactory;
/** Client channel holders for each configured address. */
- private final ClientChannelHolder[] channels;
+ private final AtomicReference<List<ClientChannelHolder>> channels = new
AtomicReference<>();
/** Index of the current channel. */
- private int curChIdx;
+ private volatile int curChIdx = -1;
- /** Partition awareness enabled. */
- private final boolean partitionAwarenessEnabled;
+ /** Is all channels should be initialized at one moment. */
Review comment:
Outdated.
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java
##########
@@ -98,265 +101,291 @@
/** Channels reinit was scheduled. */
private final AtomicBoolean scheduledChannelsReinit = new AtomicBoolean();
- /** Affinity map update is in progress. */
- private final AtomicBoolean affinityUpdateInProgress = new AtomicBoolean();
-
/** Channel is closed. */
private volatile boolean closed;
/** Fail (disconnect) listeners. */
- private ArrayList<Runnable> chFailLsnrs = new ArrayList<>();
+ private final ArrayList<Runnable> chFailLsnrs = new ArrayList<>();
- /**
- * Constructor.
- */
- ReliableChannel(
- Function<ClientChannelConfiguration, ClientChannel> chFactory,
- ClientConfiguration clientCfg,
- IgniteBinary binary
- ) throws ClientException {
+ /** Fail (disconnect) listeners. */
Review comment:
Fixed.
----------------------------------------------------------------
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]