ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] NSAmelchev commented on a change in pull request #6550: IGNITE-11671 Thin client: Client may hang when connected to a starting server
Date Wed, 22 May 2019 10:28:13 GMT
NSAmelchev commented on a change in pull request #6550: IGNITE-11671 Thin client: Client may
hang when connected to a starting server
URL: https://github.com/apache/ignite/pull/6550#discussion_r286420385
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/client/ConnectToStartingNodeTest.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.client;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.CyclicBarrier;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.ClientConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Test;
+
+/**
+ * Checks that connection with starting node will be established correctly.
+ */
+public class ConnectToStartingNodeTest extends GridCommonAbstractTest {
+    /** Client connector address. */
+    private static final String CLIENT_CONN_ADDR = "127.0.0.1:" + ClientConnectorConfiguration.DFLT_PORT;
+
+    /** Barrier to suspend discovery SPI start. */
+    private final CyclicBarrier barrier = new CyclicBarrier(2);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws
Exception {
+        return super.getConfiguration(igniteInstanceName).setDiscoverySpi(new TcpDiscoverySpi()
{
+            @Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException
{
+                try {
+                    barrier.await();
+                }
+                catch (Exception ignore) {
+                    // No-op.
+                }
+
+                super.spiStart(igniteInstanceName);
+
+                try {
+                    barrier.await();
+                }
+                catch (Exception ignore) {
+                    // No-op.
+                }
+            }
+        });
+    }
+
+    /**
+     * Test that client can't connect to server before discovery SPI start.
+     */
 
 Review comment:
   Missed javadoc for Exception

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message