Beispiel #1
0
  @Override
  public void close() throws IOException {
    zk.removeDefaultWatcher(watcher);

    schemaCache.close();

    for (ServerNode node : servers) {
      Closer.close(node.repository);
    }

    if (managedZk && zk != null) {
      zk.close();
    }

    // Close pools related to the Configuration objects managed by this LilyClient instance
    for (Configuration config : hbaseConnections.getConfigurations()) {
      LocalHTable.closePool(config);
    }

    // Close HBase connections created by [only] this LilyClient instance.
    // This will almost always contain only one connection, if not we would need a more
    // advanced connection mgmt so that these connections don't stay open for the lifetime
    // of LilyClient.
    Closer.close(hbaseConnections);

    this.isClosed = true;
  }
Beispiel #2
0
 private void init()
     throws InterruptedException, KeeperException, NoServersException, RepositoryException {
   zk.addDefaultWatcher(watcher);
   refreshServers();
   schemaCache.start();
   this.isClosed = false;
 }