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:07:46 UTC
svn commit: r1570216 - in
/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client:
HBaseAdmin.java HTableMultiplexer.java
Author: nkeywal
Date: Thu Feb 20 15:07:45 2014
New Revision: 1570216
URL: http://svn.apache.org/r1570216
Log:
HBASE-10522 Correct wrong handling and add proper handling for swallowed InterruptedException thrown by Thread.sleep in client (Feng Honghua)
Modified:
hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
Modified: hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1570216&r1=1570215&r2=1570216&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Thu Feb 20 15:07:45 2014
@@ -696,7 +696,8 @@ public class HBaseAdmin implements Abort
try {
Thread.sleep(getPauseTime(tries));
} catch (InterruptedException e) {
- // continue
+ throw new InterruptedIOException("Interrupted when waiting" +
+ " for table to be deleted");
}
}
@@ -2708,10 +2709,8 @@ public class HBaseAdmin implements Abort
LOG.debug("(#" + tries + ") Sleeping: " + sleep +
"ms while waiting for snapshot completion.");
Thread.sleep(sleep);
-
} catch (InterruptedException e) {
- LOG.debug("Interrupted while waiting for snapshot " + snapshot + " to complete");
- Thread.currentThread().interrupt();
+ throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
}
LOG.debug("Getting current status of snapshot from master...");
done = executeCallable(new MasterCallable<IsSnapshotDoneResponse>(getConnection()) {
@@ -2720,7 +2719,7 @@ public class HBaseAdmin implements Abort
return master.isSnapshotDone(null, request);
}
});
- };
+ }
if (!done.getDone()) {
throw new SnapshotCreationException("Snapshot '" + snapshot.getName()
+ "' wasn't completed in expectedTime:" + max + " ms", snapshot);
@@ -3048,10 +3047,8 @@ public class HBaseAdmin implements Abort
LOG.debug("(#" + tries + ") Sleeping: " + sleep +
"ms while waiting for procedure completion.");
Thread.sleep(sleep);
-
} catch (InterruptedException e) {
- LOG.debug("Interrupted while waiting for procedure " + signature + " to complete");
- Thread.currentThread().interrupt();
+ throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
}
LOG.debug("Getting current status of procedure from master...");
done = isProcedureFinished(signature, instance, props);
@@ -3132,8 +3129,7 @@ public class HBaseAdmin implements Abort
LOG.debug(tries + ") Sleeping: " + sleep + " ms while we wait for snapshot restore to complete.");
Thread.sleep(sleep);
} catch (InterruptedException e) {
- LOG.debug("Interrupted while waiting for snapshot " + snapshot + " restore to complete");
- Thread.currentThread().interrupt();
+ throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
}
LOG.debug("Getting current status of snapshot restore from master...");
done = executeCallable(new MasterCallable<IsRestoreSnapshotDoneResponse>(
Modified: hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java?rev=1570216&r1=1570215&r2=1570216&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java (original)
+++ hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java Thu Feb 20 15:07:45 2014
@@ -472,12 +472,14 @@ public class HTableMultiplexer {
* buffer queue.
**/
long frequency = conf.getLong(TABLE_MULTIPLEXER_FLUSH_FREQ_MS, 100);
-
+
// initial delay
try {
Thread.sleep(frequency);
} catch (InterruptedException e) {
- } // Ignore
+ LOG.warn("Interrupted while sleeping");
+ Thread.currentThread().interrupt();
+ }
long start, elapsed;
int failedCount = 0;
@@ -488,7 +490,7 @@ public class HTableMultiplexer {
// Clear the processingList, putToStatusMap and failedCount
processingList.clear();
failedCount = 0;
-
+
// drain all the queued puts into the tmp list
queue.drainTo(processingList);
currentProcessingPutCount.set(processingList.size());
@@ -567,7 +569,12 @@ public class HTableMultiplexer {
elapsed = EnvironmentEdgeManager.currentTimeMillis() - start;
}
if (elapsed < frequency) {
- Thread.sleep(frequency - elapsed);
+ try {
+ Thread.sleep(frequency - elapsed);
+ } catch (InterruptedException e) {
+ LOG.warn("Interrupted while sleeping");
+ Thread.currentThread().interrupt();
+ }
}
} catch (Exception e) {
// Log all the exceptions and move on