@Override public void close() throws IOException { cnx.close(); } }
@Override public void close() throws IOException { cnx.close(); } }
@Override public void close() throws IOException { cnx.close(); } }
public synchronized static void waitForConnection(long timeout, TimeUnit timeoutUnit) { long before = System.currentTimeMillis(); long after; long timeoutMS = TimeUnit.MILLISECONDS.convert(timeout, timeoutUnit); do { try { HConnection hc = HConnectionManager.createConnection(HBaseConfiguration.create()); hc.close(); after = System.currentTimeMillis(); log.info("HBase server to started after about {} ms", after - before); return; } catch (IOException e) { log.info("Exception caught while waiting for the HBase server to start", e); } after = System.currentTimeMillis(); } while (timeoutMS > after - before); after = System.currentTimeMillis(); log.warn("HBase server did not start in {} ms", after - before); }
/** * Cleanup any state for this DB. * Called once per DB instance; there is one DB instance per client thread. */ public void cleanup() throws DBException { // Get the measurements instance as this is the only client that should // count clean up time like an update since autoflush is off. Measurements measurements = Measurements.getMeasurements(); try { long st = System.nanoTime(); if (hTable != null) { hTable.flushCommits(); } synchronized (THREAD_COUNT) { int threadCount = THREAD_COUNT.decrementAndGet(); if (threadCount <= 0 && hConn != null) { hConn.close(); } } long en = System.nanoTime(); measurements.measure("UPDATE", (int) ((en - st) / 1000)); } catch (IOException e) { throw new DBException(e); } }
@Override public void run() { for (HConnection conn : ConnPool.values()) { try { conn.close(); } catch (IOException e) { e.printStackTrace(); } } } });
conn.close();
/** * Closes the underlying connection to zookeeper. The QueryServices * may not be used after that point. When a Connection is closed, * this is not called, since these instances are pooled by the * Driver. Instead, the Driver should call this if the QueryServices * is ever removed from the pool */ @Override public void close() throws SQLException { SQLException sqlE = null; try { // Clear Phoenix metadata cache before closing HConnection clearCache(); } catch (SQLException e) { sqlE = e; } finally { try { connection.close(); } catch (IOException e) { if (sqlE == null) { sqlE = ServerUtil.parseServerException(e); } else { sqlE.setNextException(ServerUtil.parseServerException(e)); } throw sqlE; } finally { super.close(); } } }
@Override @SuppressWarnings("WeakerAccess") public void destroy() throws IOException { if (connection != null) { connection.close(); } }
@Override public void close(TaskAttemptContext arg0) throws IOException, InterruptedException { if (connection != null) { connection.close(); } }
@Override @SuppressWarnings("WeakerAccess") public void destroy() throws IOException { if (connection != null) { connection.close(); } }
@Override public void close() throws IOException { if (this.connection != null) { this.connection.close(); } } }
@Override public void close() throws IOException { cnx.close(); } }
@Override public void stop(CoprocessorEnvironment ctx) throws IOException { if (connection != null) { connection.close(); } }
/** * Stop the ServerManager. Currently closes the connection to the master. */ public void stop() { if (connection != null) { try { connection.close(); } catch (IOException e) { LOG.error("Attempt to close connection to master failed", e); } } }
table.close(); if (conn != null) conn.close();
@Override public void run() { for (HConnection conn : ConnPool.values()) { try { conn.close(); } catch (IOException e) { e.printStackTrace(); } } } });
public void close() { if (this.scanner != null) { this.scanner.close(); } try { if (this.connection != null) { this.connection.close(); } } catch (IOException e) { LOG.error("close connection error", e); } }
// Create a connection to the cluster. HConnection connection = HConnectionManager.createConnection(Configuration); HTableInterface table = connection.getTable("myTable"); // use table as needed, the table returned is lightweight table.close(); // use the connection for other access to the cluster connection.close();
@After public void tearUp() throws IOException { if (table != null) { table.close(); } if (anotherTable != null) { anotherTable.close(); } if (connection != null) { connection.close(); } }