@Override public void cleanup() throws DBException { synchronized (MUTEX) { --threadCount; if (client != null && threadCount < 1) { try { if (debug) { System.out.println("Shutting down client"); } client.shutdown().joinUninterruptibly(joinTimeout); } catch (Exception e) { System.err.println("Failed to shutdown the AsyncHBase client " + "properly: " + e.getMessage()); } client = null; } } }
private void shutdownHBaseClient() { logger.info("Shutting down HBase Client"); final CountDownLatch waiter = new CountDownLatch(1); try { client.shutdown().addCallback(new Callback<Object, Object>() { @Override public Object call(Object arg) throws Exception { waiter.countDown(); return null; } }).addErrback(new Callback<Object, Object>() { @Override public Object call(Object arg) throws Exception { logger.error("Failed to shutdown HBase client cleanly! HBase cluster might be down"); waiter.countDown(); return null; } }); if (!waiter.await(timeout, TimeUnit.NANOSECONDS)) { logger.error("HBase connection could not be closed within timeout! HBase cluster might " + "be down!"); } } catch (Exception ex) { logger.warn("Error while attempting to close connections to HBase"); } finally { // Dereference the client to force GC to clear up any buffered requests. client = null; } }
@Override public void shutdown() { client.shutdown(); } }
/** * Performs a graceful shutdown of this client, flushing any pending requests. * * @return a {@link Deferred} indicating the completion of the shutdown operation. * * @see org.hbase.async.HBaseClient#shutdown() */ public Deferred<Object> shutdown() { return client.shutdown(); }
private void shutdownHBaseClient() { logger.info("Shutting down HBase Client"); final CountDownLatch waiter = new CountDownLatch(1); try { client.shutdown().addCallback(new Callback<Object, Object>() { @Override public Object call(Object arg) throws Exception { waiter.countDown(); return null; } }).addErrback(new Callback<Object, Object>() { @Override public Object call(Object arg) throws Exception { logger.error("Failed to shutdown HBase client cleanly! HBase cluster might be down"); waiter.countDown(); return null; } }); if (!waiter.await(timeout, TimeUnit.NANOSECONDS)) { logger.error("HBase connection could not be closed within timeout! HBase cluster might " + "be down!"); } } catch (Exception ex) { logger.warn("Error while attempting to close connections to HBase"); } finally { // Dereference the client to force GC to clear up any buffered requests. client = null; } }
public static void main(String[] args) throws Throwable { if (args.length == 0 || "help".equals(args[0])) { System.out.println(usage); System.exit(0); } final HBaseClient client = new HBaseClient("localhost"); if ("update".equals(args[0])) { Deferred<ArrayList<Object>> d = Deferred.group(doList(client)); try { d.join(); } catch (DeferredGroupException e) { LOG.info(e.getCause().getMessage()); } } client.shutdown().joinUninterruptibly(); }
? compactionq.flush().addCallbacks(new HClientShutdown(), new ShutdownErrback()) : client.shutdown();
@Override public void dispose() { super.dispose(); if (_client != null) { _logger.info("Shutting down asynchbase client."); Deferred<Object> deferred = _client.shutdown(); deferred.addCallback(new Callback<Void, Object>() { @Override public Void call(Object arg) throws Exception { _logger.info("Shutdown of asynchbase client complete."); return null; } }); deferred.addErrback(new Callback<Void, Exception>() { @Override public Void call(Exception arg) throws Exception { _logger.warn("Error occurred while shutting down asynchbase client."); return null; } }); try { deferred.join(TIMEOUT_MS); } catch (Exception e) { throw new SystemException("Exception while waiting for shutdown to complete.", e); } } }
@Override public void dispose() { super.dispose(); if (_client != null) { _logger.info("HBaseHistoryService: Shutting down asynchbase client."); Deferred<Object> deferred = _client.shutdown(); deferred.addCallback(new Callback<Void, Object>() { @Override public Void call(Object arg) throws Exception { _logger.info("Shutdown of asynchbase client complete."); return null; } }); deferred.addErrback(new Callback<Void, Exception>() { @Override public Void call(Exception arg) throws Exception { _logger.warn("Error occurred while shutting down asynchbase client."); return null; } }); try { deferred.join(SHUTDOWN_TIMEOUT_MS); } catch (Exception e) { throw new SystemException("Exception while waiting for shutdown to complete.", e); } } }
@Override public void dispose() { super.dispose(); if (_client != null) { _logger.info("HBaseAuditService: Shutting down asynchbase client."); Deferred<Object> deferred = _client.shutdown(); deferred.addCallback(new Callback<Void, Object>() { @Override public Void call(Object arg) throws Exception { _logger.info("Shutdown of asynchbase client complete."); return null; } }); deferred.addErrback(new Callback<Void, Exception>() { @Override public Void call(Exception arg) throws Exception { _logger.warn("Error occurred while shutting down asynchbase client."); return null; } }); try { deferred.join(SHUTDOWN_TIMEOUT_MS); } catch (Exception e) { throw new SystemException("Exception while waiting for shutdown to complete.", e); } } }
@Override public void dispose() { super.dispose(); if (_client != null) { _logger.info("Shutting down asynchbase client."); Deferred<Object> deferred = _client.shutdown(); deferred.addCallback(new Callback<Void, Object>() { @Override public Void call(Object arg) throws Exception { _logger.info("Shutdown of asynchbase client complete."); return null; } }); deferred.addErrback(new Callback<Void, Exception>() { @Override public Void call(Exception arg) throws Exception { _logger.warn("Error occurred while shutting down asynchbase client."); return null; } }); try { deferred.join(TIMEOUT_MS); } catch (Exception e) { throw new SystemException("Exception while waiting for shutdown to complete.", e); } } }
@Override public void dispose() { super.dispose(); if (_client != null) { _logger.info("HBaseAuditService: Shutting down asynchbase client."); Deferred<Object> deferred = _client.shutdown(); deferred.addCallback(new Callback<Void, Object>() { @Override public Void call(Object arg) throws Exception { _logger.info("Shutdown of asynchbase client complete."); return null; } }); deferred.addErrback(new Callback<Void, Exception>() { @Override public Void call(Exception arg) throws Exception { _logger.warn("Error occurred while shutting down asynchbase client."); return null; } }); try { deferred.join(SHUTDOWN_TIMEOUT_MS); } catch (Exception e) { throw new SystemException("Exception while waiting for shutdown to complete.", e); } } }
@Override public void dispose() { super.dispose(); if (_client != null) { _logger.info("HBaseHistoryService: Shutting down asynchbase client."); Deferred<Object> deferred = _client.shutdown(); deferred.addCallback(new Callback<Void, Object>() { @Override public Void call(Object arg) throws Exception { _logger.info("Shutdown of asynchbase client complete."); return null; } }); deferred.addErrback(new Callback<Void, Exception>() { @Override public Void call(Exception arg) throws Exception { _logger.warn("Error occurred while shutting down asynchbase client."); return null; } }); try { deferred.join(SHUTDOWN_TIMEOUT_MS); } catch (Exception e) { throw new SystemException("Exception while waiting for shutdown to complete.", e); } } }
} finally { try { client.shutdown().joinUninterruptibly(); } catch (Exception e) { LOG.error("Unexpected exception while shutting down", e);
factory.releaseExternalResources(); try { client.shutdown().joinUninterruptibly(); } catch (Exception e2) { log.error("Failed to shutdown HBase client", e2);
this.client.shutdown().addErrback(this.cbLogger); } catch (Exception e) { this.logger.error("An Exception has been caught while shuting down the HBase client", e, (Object[]) null);