This would retry indefinitely, right ? Normally maximum retry duration would govern how long the retry is attempted.
On Mon, Jun 27, 2011 at 1:08 PM, Alex Baranau <[email protected]>wrote: > Hello, > > Just wanted to confirm that I'm doing things in a proper way here. How > about > this code to handle the temp cluster connectivity problems (or cluster down > time) on client-side? > > + // HTable.put() will fail with exception if connection to cluster is > temporarily broken or > + // cluster is temporarily down. To be sure data is written we retry > writing. > + boolean dataWritten = false; > + do { > + try { > + table.put(p); > + dataWritten = true; > + } catch (IOException ioe) { // indicates cluster connectivity > problem > (also thrown when cluster is down) > + LOG.error("Writing data to HBase failed, will try again in " + > RETRY_INTERVAL_ON_WRITE_FAIL + " sec", ioe); > + Thread.currentThread().wait(RETRY_INTERVAL_ON_WRITE_FAIL * 1000); > + } > + } while (!dataWritten); > > Thank you in advance, > Alex Baranau > ---- > Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - Hadoop - HBase >
