asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Lychagin (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: [ASTERIXDB-2009][RT] Improve error reporting in MultiplexedC...
Date Tue, 01 Aug 2017 20:24:50 GMT
Dmitry Lychagin has submitted this change and it was merged.

Change subject: [ASTERIXDB-2009][RT] Improve error reporting in MultiplexedConnection
......................................................................


[ASTERIXDB-2009][RT] Improve error reporting in MultiplexedConnection

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- retain cause exception and ip address when raising error
  in MultiplexedConnection.waitUntilConnected()

Change-Id: I39c2db3b966dbde5c4c04ba061132a74195fb155
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1910
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
---
M hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
M hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
M hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
M hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
4 files changed, 10 insertions(+), 9 deletions(-)

Approvals:
  Yingyi Bu: Looks good to me, approved
  Jenkins: Verified; No violations found; No violations found; Verified



diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
index ad8aabd..8c54c65 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MultiplexedConnection.java
@@ -110,8 +110,9 @@
         notifyAll();
     }
 
-    synchronized void setConnectionFailure() {
+    synchronized void setConnectionFailure(Exception e) {
         this.connectionFailure = true;
+        this.error = e;
         notifyAll();
     }
 
@@ -120,7 +121,7 @@
             wait();
         }
         if (connectionFailure) {
-            throw new NetException("Connection failure");
+            throw new NetException("Connection failure", error);
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
index 7e6c8d7..f6261da 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/muxdemux/MuxDemux.java
@@ -92,7 +92,7 @@
             }
 
             @Override
-            public void connectionFailure(InetSocketAddress remoteAddress) {
+            public void connectionFailure(InetSocketAddress remoteAddress, IOException error)
{
                 MultiplexedConnection mConn;
                 synchronized (MuxDemux.this) {
                     mConn = connectionMap.get(remoteAddress);
@@ -100,7 +100,7 @@
                     int nConnectionAttempts = mConn.getConnectionAttempts();
                     if (nConnectionAttempts > MuxDemux.this.maxConnectionAttempts) {
                         connectionMap.remove(remoteAddress);
-                        mConn.setConnectionFailure();
+                        mConn.setConnectionFailure(new IOException(remoteAddress.toString()
+ ": " + error, error));
                     } else {
                         mConn.setConnectionAttempts(nConnectionAttempts + 1);
                         tcpEndpoint.initiateConnection(remoteAddress);
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
index 9fe0421..b801cd3 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/ITCPConnectionListener.java
@@ -18,6 +18,7 @@
  */
 package org.apache.hyracks.net.protocols.tcp;
 
+import java.io.IOException;
 import java.net.InetSocketAddress;
 
 public interface ITCPConnectionListener {
@@ -25,5 +26,5 @@
 
     public void connectionEstablished(TCPConnection connection);
 
-    public void connectionFailure(InetSocketAddress remoteAddress);
+    public void connectionFailure(InetSocketAddress remoteAddress, IOException error);
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
index 41e0dd2..52f4c30 100644
--- a/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
+++ b/hyracks-fullstack/hyracks/hyracks-net/src/main/java/org/apache/hyracks/net/protocols/tcp/TCPEndpoint.java
@@ -132,7 +132,7 @@
                             } catch (IOException e) {
                                 failure = true;
                                 synchronized (connectionListener) {
-                                    connectionListener.connectionFailure(address);
+                                    connectionListener.connectionFailure(address, e);
                                 }
                             }
                             if (!failure) {
@@ -188,11 +188,10 @@
                                 boolean finishConnect = false;
                                 try {
                                     finishConnect = channel.finishConnect();
-                                } catch (Exception e) {
-                                    e.printStackTrace();
+                                } catch (IOException e) {
                                     key.cancel();
                                     synchronized (connectionListener) {
-                                        connectionListener.connectionFailure((InetSocketAddress)
key.attachment());
+                                        connectionListener.connectionFailure((InetSocketAddress)
key.attachment(), e);
                                     }
                                 }
                                 if (finishConnect) {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1910
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I39c2db3b966dbde5c4c04ba061132a74195fb155
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Gerrit-Reviewer: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message