class ZKRegistry implements TaskLifecycleListener, DrillbitStatusListener, Pollable {

  public void start(RegistryHandler controller) {
    this.registryHandler = controller;
    try {
      zkDriver.build();
    } catch (ZKRuntimeException e) {
      LOG.error("Failed to start ZK monitoring", e);
      throw new AMWrapperException("Failed to start ZK monitoring", e);
    }
    for (DrillbitEndpoint dbe : zkDriver.getInitialEndpoints()) {
      String key = toKey(dbe);
      registry.put(key, new DrillbitTracker(key, dbe));

      // Blacklist the host for each unmanaged drillbit.

      controller.reserveHost(dbe.getAddress());

      LOG.warn("Host " + dbe.getAddress()
          + " already running a Drillbit outside of YARN.");
    }
    zkDriver.addDrillbitListener(this);
  }

  public  ZKRegistry(ZKClusterCoordinatorDriver zkDriver);

}