Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-901 af794515b -> c0e62bd58


# ignite-901


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c0e62bd5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c0e62bd5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c0e62bd5

Branch: refs/heads/ignite-901
Commit: c0e62bd58f8c0a22bd919a2bf137c664c1a179d2
Parents: af79451
Author: sboikov <sboi...@gridgain.com>
Authored: Mon Jul 13 16:41:19 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Mon Jul 13 16:41:19 2015 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |  5 +++
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  2 +-
 .../IgniteClientReconnectApiExceptionTest.java  | 39 ++++++++++----------
 3 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c0e62bd5/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index de56a16..64a5e89 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -1589,6 +1589,11 @@ public class GridDiscoveryManager extends 
GridManagerAdapter<DiscoverySpi> {
         try {
             getSpi().sendCustomEvent(new CustomMessageWrapper(msg));
         }
+        catch (IgniteClientDisconnectedException e) {
+            IgniteFuture<?> reconnectFut = 
ctx.cluster().clientReconnectFuture();
+
+            throw new IgniteClientDisconnectedCheckedException(reconnectFut, 
e.getMessage());
+        }
         catch (IgniteException e) {
             throw new IgniteCheckedException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c0e62bd5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index b6e9573..f812dba 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -350,7 +350,7 @@ class ClientImpl extends TcpDiscoveryImpl {
             throw new IgniteException("Failed to send custom message: client 
is segmented.");
 
         if (state == DISCONNECTED)
-            throw new IgniteException("Failed to send custom message: client 
is disconnected.");
+            throw new IgniteClientDisconnectedException(null, "Failed to send 
custom message: client is disconnected.");
 
         try {
             sockWriter.sendMessage(new 
TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c0e62bd5/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
index 925e265..37773cd 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
@@ -32,6 +32,7 @@ import javax.cache.processor.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.apache.ignite.events.EventType.*;
 
 /**
@@ -197,9 +198,9 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
 
         final Ignite client = startGrid(serverCount());
 
-        final IgniteCache<Object, Object> defaultCache = client.cache(null);
+        final IgniteCache<Object, Object> dfltCache = client.cache(null);
 
-        assertNotNull(defaultCache);
+        assertNotNull(dfltCache);
 
         doTestIgniteOperationOnDisconnect(client, Arrays.asList(
             // Check put and get operation.
@@ -209,7 +210,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                         boolean failed = false;
 
                         try {
-                            defaultCache.getAndPut(9999, 9999);
+                            dfltCache.getAndPut(9999, 9999);
                         }
                         catch (CacheException e) {
                             failed = true;
@@ -219,14 +220,14 @@ public class IgniteClientReconnectApiExceptionTest 
extends IgniteClientReconnect
 
                         assertTrue(failed);
 
-                        return defaultCache.getAndPut(9999, 9999);
+                        return dfltCache.getAndPut(9999, 9999);
                     }
                 },
                 new C1<Object, Boolean>() {
                     @Override public Boolean apply(Object o) {
                         assertNull(o);
 
-                        assertEquals(9999, defaultCache.get(9999));
+                        assertEquals(9999, dfltCache.get(9999));
 
                         return true;
                     }
@@ -239,7 +240,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                         boolean failed = false;
 
                         try {
-                            defaultCache.put(10000, 10000);
+                            dfltCache.put(10000, 10000);
                         }
                         catch (CacheException e) {
                             failed = true;
@@ -249,7 +250,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
 
                         assertTrue(failed);
 
-                        defaultCache.put(10000, 10000);
+                        dfltCache.put(10000, 10000);
 
                         return true;
                     }
@@ -258,7 +259,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                     @Override public Boolean apply(Object o) {
                         assertTrue((Boolean)o);
 
-                        assertEquals(10000, defaultCache.get(10000));
+                        assertEquals(10000, dfltCache.get(10000));
 
                         return true;
                     }
@@ -271,7 +272,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                         boolean failed = false;
 
                         try {
-                            defaultCache.get(10001);
+                            dfltCache.get(10001);
                         }
                         catch (CacheException e) {
                             failed = true;
@@ -281,7 +282,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
 
                         assertTrue(failed);
 
-                        return defaultCache.get(10001);
+                        return dfltCache.get(10001);
                     }
                 },
                 new C1<Object, Boolean>() {
@@ -299,7 +300,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                         boolean failed = false;
 
                         try {
-                            defaultCache.invoke(10000, new 
CacheEntryProcessor<Object, Object, Object>() {
+                            dfltCache.invoke(10000, new 
CacheEntryProcessor<Object, Object, Object>() {
                                 @Override public Object 
process(MutableEntry<Object, Object> entry,
                                     Object... arguments) throws 
EntryProcessorException {
                                     assertTrue(entry.exists());
@@ -316,7 +317,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
 
                         assertTrue(failed);
 
-                        return defaultCache.invoke(10000, new 
CacheEntryProcessor<Object, Object, Object>() {
+                        return dfltCache.invoke(10000, new 
CacheEntryProcessor<Object, Object, Object>() {
                             @Override public Object 
process(MutableEntry<Object, Object> entry,
                                 Object... arguments) throws 
EntryProcessorException {
                                 assertTrue(entry.exists());
@@ -340,7 +341,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
             new T2<Callable, C1<Object, Boolean>>(
                 new Callable() {
                     @Override public Object call() throws Exception {
-                        IgniteCache<Object, Object> async = 
defaultCache.withAsync();
+                        IgniteCache<Object, Object> async = 
dfltCache.withAsync();
 
                         boolean failed = false;
 
@@ -366,7 +367,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                     @Override public Boolean apply(Object o) {
                         assertNull(o);
 
-                        assertEquals(10002, defaultCache.get(10002));
+                        assertEquals(10002, dfltCache.get(10002));
 
                         return true;
                     }
@@ -682,7 +683,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
                         msg.send(null, "Test message.");
 
                         try {
-                            assertTrue(recvLatch.await(2, TimeUnit.SECONDS));
+                            assertTrue(recvLatch.await(2, SECONDS));
                         }
                         catch (InterruptedException e) {
                             fail("Message wasn't received.");
@@ -795,7 +796,7 @@ public class IgniteClientReconnectApiExceptionTest extends 
IgniteClientReconnect
 
             srvSpi.failNode(client.cluster().localNode().id(), null);
 
-            assertTrue(disconnectLatch.await(5000, TimeUnit.MILLISECONDS));
+            waitReconnectEvent(disconnectLatch);
 
             assertEquals(ops.size(), futs.size());
 
@@ -818,13 +819,13 @@ public class IgniteClientReconnectApiExceptionTest 
extends IgniteClientReconnect
                 final int i0 = i;
 
                 try {
-                    final Object furRes = futs.get(i0).get(2, 
TimeUnit.SECONDS);
+                    final Object futRes = futs.get(i0).get(2, SECONDS);
 
                     assertTrue(GridTestUtils.runAsync(new Callable<Boolean>() {
                         @Override public Boolean call() throws Exception {
-                            return ops.get(i0).get2().apply(furRes);
+                            return ops.get(i0).get2().apply(futRes);
                         }
-                    }).get(2, TimeUnit.SECONDS));
+                    }).get(2, SECONDS));
                 }
                 catch (IgniteFutureTimeoutCheckedException e) {
                     e.printStackTrace();

Reply via email to