/** * Delete stale connection information for the instance specified by configuration. * This will then close connection to * the zookeeper ensemble and let go of all resources. * * @param connection */ public static void deleteStaleConnection(HConnection connection) { deleteConnection(connection, true); }
/** * Delete connection information for the instance specified by configuration. * If there are no more references to it, this will then close connection to * the zookeeper ensemble and let go of all resources. * * @param conf * configuration whose identity is used to find {@link HConnection} * instance. * @param stopProxy * No longer used. This parameter is ignored. * @deprecated use {@link #createConnection(org.apache.hadoop.conf.Configuration)} instead */ @Deprecated public static void deleteConnection(Configuration conf, boolean stopProxy) { deleteConnection(conf); }
private static void deleteConnection(HConnection connection, boolean staleConnection) { synchronized (HBASE_INSTANCES) { for (Entry<HConnectionKey, HConnectionImplementation> connectionEntry : HBASE_INSTANCES .entrySet()) { if (connectionEntry.getValue() == connection) { deleteConnection(connectionEntry.getKey(), staleConnection); break; } } } }
/** * Delete information for all connections. * @throws IOException */ public static void deleteAllConnections() { synchronized (HBASE_INSTANCES) { Set<HConnectionKey> connectionKeys = new HashSet<HConnectionKey>(); connectionKeys.addAll(HBASE_INSTANCES.keySet()); for (HConnectionKey connectionKey : connectionKeys) { deleteConnection(connectionKey, false); } HBASE_INSTANCES.clear(); } }
@Override public void close() throws IOException { this.htable.close(); if(config!=null) HConnectionManager.deleteConnection(config); } }
/** * Delete connection information for the instance specified by configuration. * If there are no more references to it, this will then close connection to * the zookeeper ensemble and let go of all resources. * * @param conf * configuration whose identity is used to find {@link HConnection} * instance. */ public static void deleteConnection(Configuration conf) { deleteConnection(new HConnectionKey(conf), false); }
@PreDestroy public void stop() { try { // LocalHTable keeps HTablePools in static vars: make sure that is cleaned out // (to avoid leaks when using resetLilyState) LocalHTable.closeAllPools(); // FIXME : is this still needed? HConnectionManager.deleteConnection(conf, true); } catch (Throwable t) { LogFactory.getLog(getClass()).error("Problem cleaning up HBase connections", t); } } }
@Override public void close() throws IOException { this.htable.close(); if(config!=null) HConnectionManager.deleteConnection(config); }
@Override public void stop(String why) { if (this.stopped) return; this.stopped = true; if (this.zkHelper != null) { LOG.info("Stopping " + this.zkHelper.getZookeeperWatcher()); this.zkHelper.getZookeeperWatcher().close(); } // Not sure why we're deleting a connection that we never acquired or used HConnectionManager.deleteConnection(this.getConf()); }
/** * Get the connection that goes with the passed <code>conf</code> * configuration instance. * If no current connection exists, method creates a new connection for the * passed <code>conf</code> instance. * @param conf configuration * @return HConnection object for <code>conf</code> * @throws ZooKeeperConnectionException */ public static HConnection getConnection(Configuration conf) throws ZooKeeperConnectionException { HConnectionKey connectionKey = new HConnectionKey(conf); synchronized (HBASE_INSTANCES) { HConnectionImplementation connection = HBASE_INSTANCES.get(connectionKey); if (connection == null) { connection = new HConnectionImplementation(conf, true); HBASE_INSTANCES.put(connectionKey, connection); } else if (connection.isClosed()) { HConnectionManager.deleteConnection(connectionKey, true); connection = new HConnectionImplementation(conf, true); HBASE_INSTANCES.put(connectionKey, connection); } connection.incCount(); return connection; } }
HConnectionManager.deleteConnection(admin.getConfiguration(), false);
HConnectionManager.deleteConnection(hbadmin.getConfiguration());