Merge pull request #223 from nlevitt/hbase-refactor

merging reset HBaseAdmin on error
This commit is contained in:
Barbara Miller
2018-12-03 15:07:35 -08:00
committed by GitHub
2 changed files with 15 additions and 0 deletions
@@ -111,4 +111,16 @@ public class HBase implements Lifecycle {
public void start() {
isRunning = true;
}
public synchronized void reset() {
if (admin != null) {
try {
admin.close();
} catch (IOException e) {
logger.warning("problem closing HBaseAdmin " + admin + " - " + e);
}
admin = null;
}
}
}
@@ -115,6 +115,7 @@ public class HBaseTable extends HBaseTableBean {
} catch (IOException e) {
logger.log(Level.WARNING, "(attempt " + attempt + ") problem creating hbase table " + htableName, e);
attempt++;
reset();
// back off up to 60 seconds between retries
try {
Thread.sleep(Math.min(attempt * 1000, 60000));
@@ -145,6 +146,8 @@ public class HBaseTable extends HBaseTableBean {
}
hconn.remove();
}
hbase.reset();
}
@Override