HBASE-10652 Fix incorrect handling of IE that restores current thread's interrupt status within while/for loops in rpc (Feng Honghua)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1573937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2014-03-04 08:45:15 +00:00
parent fbf2cc5377
commit 84f48f87f8
1 changed files with 12 additions and 5 deletions

View File

@ -154,11 +154,18 @@ public class SimpleRpcScheduler implements RpcScheduler {
}
private void consumerLoop(BlockingQueue<CallRunner> myQueue) {
boolean interrupted = false;
try {
while (running) {
try {
CallRunner task = myQueue.take();
task.run();
} catch (InterruptedException e) {
interrupted = true;
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}