You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nk...@apache.org on 2014/02/20 16:03:18 UTC

svn commit: r1570212 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java

Author: nkeywal
Date: Thu Feb 20 15:03:17 2014
New Revision: 1570212

URL: http://svn.apache.org/r1570212
Log:
HBASE-10521 Add handling for swallowed InterruptedException thrown by Thread.sleep in RpcServer (Feng Honghua)

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java?rev=1570212&r1=1570211&r2=1570212&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java Thu Feb 20 15:03:17 2014
@@ -584,10 +584,8 @@ public class RpcServer implements RpcSer
               key = null;
             }
           } catch (InterruptedException e) {
-            if (running) {                      // unexpected -- log it
-              LOG.info(getName() + ": unexpectedly interrupted: " +
-                StringUtils.stringifyException(e));
-            }
+            LOG.debug("Interrupted while sleeping");
+            return;
           } catch (IOException ex) {
             LOG.error(getName() + ": error in Reader", ex);
           }
@@ -702,13 +700,19 @@ public class RpcServer implements RpcSer
             LOG.warn(getName() + ": OutOfMemoryError in server select", e);
             closeCurrentConnection(key, e);
             cleanupConnections(true);
-            try { Thread.sleep(60000); } catch (Exception ignored) {}
+            try {
+              Thread.sleep(60000);
+            } catch (InterruptedException ex) {
+              LOG.debug("Interrupted while sleeping");
+              return;
+            }
           }
         } catch (Exception e) {
           closeCurrentConnection(key, e);
         }
         cleanupConnections(false);
       }
+
       LOG.info(getName() + ": stopping");
 
       synchronized (this) {
@@ -859,7 +863,6 @@ public class RpcServer implements RpcSer
 
     private void doRunLoop() {
       long lastPurgeTime = 0;   // last check for old calls.
-
       while (running) {
         try {
           waitPending();     // If a channel is being registered, wait.
@@ -870,7 +873,7 @@ public class RpcServer implements RpcSer
             iter.remove();
             try {
               if (key.isValid() && key.isWritable()) {
-                  doAsyncWrite(key);
+                doAsyncWrite(key);
               }
             } catch (IOException e) {
               LOG.info(getName() + ": asyncWrite", e);
@@ -921,11 +924,16 @@ public class RpcServer implements RpcSer
             // some thread(s) a chance to finish
             //
             LOG.warn(getName() + ": OutOfMemoryError in server select", e);
-            try { Thread.sleep(60000); } catch (Exception ignored) {}
+            try {
+              Thread.sleep(60000);
+            } catch (InterruptedException ex) {
+              LOG.debug("Interrupted while sleeping");
+              return;
+            }
           }
         } catch (Exception e) {
           LOG.warn(getName() + ": exception in Responder " +
-                   StringUtils.stringifyException(e));
+              StringUtils.stringifyException(e));
         }
       }
       LOG.info(getName() + ": stopped");