HBASE-10521 Add handling for swallowed InterruptedException thrown by Thread.sleep in RpcServer (Feng Honghua)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1570212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2014-02-20 15:03:17 +00:00
parent f20938d8ec
commit 1d52d528c9
1 changed files with 17 additions and 9 deletions

View File

@ -584,10 +584,8 @@ public class RpcServer implements RpcServerInterface {
key = null; key = null;
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (running) { // unexpected -- log it LOG.debug("Interrupted while sleeping");
LOG.info(getName() + ": unexpectedly interrupted: " + return;
StringUtils.stringifyException(e));
}
} catch (IOException ex) { } catch (IOException ex) {
LOG.error(getName() + ": error in Reader", ex); LOG.error(getName() + ": error in Reader", ex);
} }
@ -702,13 +700,19 @@ public class RpcServer implements RpcServerInterface {
LOG.warn(getName() + ": OutOfMemoryError in server select", e); LOG.warn(getName() + ": OutOfMemoryError in server select", e);
closeCurrentConnection(key, e); closeCurrentConnection(key, e);
cleanupConnections(true); 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) { } catch (Exception e) {
closeCurrentConnection(key, e); closeCurrentConnection(key, e);
} }
cleanupConnections(false); cleanupConnections(false);
} }
LOG.info(getName() + ": stopping"); LOG.info(getName() + ": stopping");
synchronized (this) { synchronized (this) {
@ -859,7 +863,6 @@ public class RpcServer implements RpcServerInterface {
private void doRunLoop() { private void doRunLoop() {
long lastPurgeTime = 0; // last check for old calls. long lastPurgeTime = 0; // last check for old calls.
while (running) { while (running) {
try { try {
waitPending(); // If a channel is being registered, wait. waitPending(); // If a channel is being registered, wait.
@ -921,7 +924,12 @@ public class RpcServer implements RpcServerInterface {
// some thread(s) a chance to finish // some thread(s) a chance to finish
// //
LOG.warn(getName() + ": OutOfMemoryError in server select", e); 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) { } catch (Exception e) {
LOG.warn(getName() + ": exception in Responder " + LOG.warn(getName() + ": exception in Responder " +