tkalkirill commented on code in PR #13836:
URL: https://github.com/apache/ignite/pull/13836#discussion_r4584879739


##########
modules/core/src/test/java/org/apache/ignite/internal/client/thin/events/IgniteClientConnectionIdTest.java:
##########
@@ -0,0 +1,246 @@
+/*
+ * 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.events;
+
+import java.io.DataInputStream;
+import java.net.Socket;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.client.ClientException;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.client.IgniteClientFuture;
+import org.apache.ignite.client.events.ConnectionClosedEvent;
+import org.apache.ignite.client.events.ConnectionDescription;
+import org.apache.ignite.client.events.ConnectionEventListener;
+import org.apache.ignite.client.events.HandshakeStartEvent;
+import org.apache.ignite.client.events.HandshakeSuccessEvent;
+import org.apache.ignite.client.events.RequestEvent;
+import org.apache.ignite.client.events.RequestEventListener;
+import org.apache.ignite.client.events.RequestFailEvent;
+import org.apache.ignite.client.events.RequestStartEvent;
+import org.apache.ignite.client.events.RequestSuccessEvent;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.internal.binary.BinaryReaderEx;
+import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.binary.BinaryWriterEx;
+import org.apache.ignite.internal.binary.streams.BinaryStreams;
+import org.apache.ignite.internal.client.thin.AbstractThinClientTest;
+import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
+import org.apache.ignite.mxbean.ClientProcessorMXBean;
+import org.apache.ignite.spi.systemview.view.ClientConnectionView;
+import org.apache.ignite.spi.systemview.view.SystemView;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.client.thin.ProtocolVersion.LATEST_VER;
+import static 
org.apache.ignite.internal.processors.odbc.ClientListenerProcessor.CLI_CONN_VIEW;
+import static org.apache.ignite.internal.util.CommonUtils.HANDSHAKE;
+import static org.apache.ignite.internal.util.CommonUtils.THIN_CLIENT;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertNotEquals;
+
+/** Tests server-assigned connection IDs in thin client events and 
diagnostics. */
+public class IgniteClientConnectionIdTest extends AbstractThinClientTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGrid(0);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        super.afterTest();
+    }
+
+    /** Tests IDs in events, including an asynchronous failure delivered after 
reconnection. */
+    @Test
+    public void testConnectionIdAfterReconnect() throws Exception {
+        List<ConnectionDescription> starts = new CopyOnWriteArrayList<>();

Review Comment:
   I suggest using ConcurrentLinkedQueue instead of CopyOnWriteArrayList.



##########
modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java:
##########
@@ -32,6 +32,9 @@ public class ConnectionDescription {
     /** Server node id. */
     private final UUID srvNodeId;
 
+    /** Server-assigned connection ID. */
+    private final Long connId;

Review Comment:
   ```suggestion
       private final @Nullable Long connId;
   ```



##########
modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java:
##########
@@ -124,6 +125,9 @@ class TcpClientChannel implements ClientChannel, 
ClientMessageHandler, ClientCon
     /** Server node ID. */
     private volatile UUID srvNodeId;
 
+    /** Server-assigned connection ID. */
+    private volatile Long connId;

Review Comment:
   ```suggestion
       private volatile @Nullable Long connId;
   ```



##########
modules/core/src/test/java/org/apache/ignite/internal/client/thin/events/IgniteClientConnectionEventListenerTest.java:
##########
@@ -65,7 +65,17 @@ public class IgniteClientConnectionEventListenerTest extends 
GridCommonAbstractT
     /** */
     @Test
     public void testBasic() throws Exception {
-        ProtocolVersion srvVer = ProtocolVersion.V1_6_0;
+        testBasic(ProtocolVersion.V1_6_0);
+    }
+
+    /** Tests a server with feature negotiation but without connection ID 
support. */
+    @Test
+    public void testWithoutConnectionIdFeature() throws Exception {

Review Comment:
   Am I correct in understanding that this checks for backward compatibility 
with other versions of the protocol?



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