On Fri, Mar 14, 2014 at 4:00 AM, sumitshrestha <[email protected]> wrote:
> I have backend hbase database and need to test whether they are working or
> not. I am using HBaseAdmin.checkHBaseAvailable(config); method to test if
> hbase is running. Here is the code snippet
>
> try {
> HBaseAdmin.checkHBaseAvailable(config);
> return true
> }
> catch (ZooKeeperConnectionException zo) {
> return false
> }
> catch (MasterNotRunningException masterNotRunningException) {
> return false
> }
> catch (Exception e) {
> return false
> }
>
> For testing purpose, i stop hbase service and test this method call. As
> defined in document, it should throw exception which I catch and return
> false ending processing. But, actually what happens is that it continues to
> throw zookeeper exception without any end. The function never returns back
> to caller thus causing request to go into a never ending wait cycle. One
> way
> is to maintain a thread that waits for some small period and if reply is
> not
> obtain then returns back killing current thread. But, this seems quite
> hacky
> implementation which I don’t want to implement(any bugs left may lead to
> terrible deadlock). I am still wondering that hbase api deals in such a bad
> way. I am using api version 0.94.10 of apache.
>
>
The exception you see is inside checkHBaseAvailable and therein we are
retrying? Would adjusting timeouts and retries help?
St.Ack