reset HBaseAdmin on error

maybe with this change it will be able to recover
This commit is contained in:
Noah Levitt
2018-12-03 14:52:20 -08:00
parent 5b911a09b8
commit ebcd6c8cf5
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