From 65fa5c4d82298e0933701954182d4e9249437462 Mon Sep 17 00:00:00 2001 From: nkeywal Date: Thu, 20 Feb 2014 15:10:03 +0000 Subject: [PATCH] HBASE-10519 Add handling for swallowed InterruptedException thrown by Thread.sleep in rest related files (Feng Honghua) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1570217 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/rest/client/RemoteAdmin.java | 17 ++++++++-- .../hbase/rest/client/RemoteHTable.java | 31 ++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java index c48ab986593..7a9016a3084 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.rest.client; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InterruptedIOException; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -130,6 +131,7 @@ public class RemoteAdmin { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: @@ -171,6 +173,7 @@ public class RemoteAdmin { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: @@ -219,6 +222,7 @@ public class RemoteAdmin { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: @@ -256,7 +260,9 @@ public class RemoteAdmin { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("get request to " + path.toString() + " returned " + code); @@ -293,7 +299,9 @@ public class RemoteAdmin { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("create request to " + path.toString() + " returned " + code); @@ -336,7 +344,9 @@ public class RemoteAdmin { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("delete request to " + path.toString() + " returned " + code); @@ -377,6 +387,7 @@ public class RemoteAdmin { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java index 0e17362a3eb..49dc8c79b24 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java @@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.rest.client; import java.io.IOException; +import java.io.InterruptedIOException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -268,7 +269,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("schema request returned " + code); @@ -344,7 +347,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("get request returned " + code); @@ -389,7 +394,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("put request failed with " + code); @@ -443,7 +450,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("multiput request failed with " + code); @@ -464,7 +473,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("delete request failed with " + code); @@ -510,7 +521,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("scan request failed with " + code); @@ -539,7 +552,9 @@ public class RemoteHTable implements HTableInterface { case 509: try { Thread.sleep(sleepTime); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); + } break; default: throw new IOException("scanner.next request failed with " + code); @@ -660,6 +675,7 @@ public class RemoteHTable implements HTableInterface { try { Thread.sleep(sleepTime); } catch (final InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: @@ -700,6 +716,7 @@ public class RemoteHTable implements HTableInterface { try { Thread.sleep(sleepTime); } catch (final InterruptedException e) { + throw (InterruptedIOException)new InterruptedIOException().initCause(e); } break; default: