ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [2/2] incubator-ignite git commit: # IGNITE-1121 Support reconnect.
Date Fri, 17 Jul 2015 10:37:23 GMT
# IGNITE-1121 Support reconnect.


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

Branch: refs/heads/ignite-1121
Commit: 2b614924b5d4eaedde306a7261355dfd61600a64
Parents: 8ecba36
Author: sevdokimov <sergey.evdokimov@jetbrains.com>
Authored: Fri Jul 17 13:37:16 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
Committed: Fri Jul 17 13:37:16 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/agent/AgentLauncher.java   | 14 +++++++++-----
 .../java/org/apache/ignite/agent/AgentSocket.java     |  8 +++++---
 2 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b614924/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
index 3f4593f..7886ea3 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
@@ -100,16 +100,20 @@ public class AgentLauncher {
 
             client.setMaxIdleTimeout(Long.MAX_VALUE);
 
-            AgentSocket agentSock = new AgentSocket(cfg, agent);
-
             client.start();
 
             try {
-                client.connect(agentSock, cfg.getServerUri());
+                while (true) {
+                    AgentSocket agentSock = new AgentSocket(cfg, agent);
+
+                    System.out.printf("Connecting to : %s%n", cfg.getServerUri());
+
+                    client.connect(agentSock, cfg.getServerUri());
 
-                System.out.printf("Connecting to : %s%n", cfg.getServerUri());
+                    agentSock.waitForClose();
 
-                agentSock.waitForClose();
+                    Thread.sleep(3000);
+                }
             }
             finally {
                 client.stop();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b614924/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
index 5cb5f36..1c418fa 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
@@ -22,6 +22,7 @@ import org.eclipse.jetty.websocket.api.*;
 import org.eclipse.jetty.websocket.api.annotations.*;
 
 import java.io.*;
+import java.net.*;
 import java.util.concurrent.*;
 
 /**
@@ -79,9 +80,10 @@ public class AgentSocket {
      */
     @OnWebSocketError
     public void onError(Session ses, Throwable error) {
-        System.out.printf("Error: " + ses);
-
-        error.printStackTrace();
+        if (error instanceof ConnectException)
+            System.out.println(error.getMessage());
+        else
+            error.printStackTrace();
 
         closeLatch.countDown();
     }


Mime
View raw message