CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, HConnection connection, Abortable abortable) throws IOException { this.connection = connection; if (abortable == null) { // A connection is abortable. this.abortable = this.connection; } Abortable throwableAborter = new Abortable() { @Override public void abort(String why, Throwable e) { throw new RuntimeException(why, e); } @Override public boolean isAborted() { return true; } }; if (zk == null) { // Create our own. Set flag so we tear it down on stop. this.zookeeper = new ZooKeeperWatcher(conf, "catalogtracker-on-" + connection.toString(), abortable); instantiatedzkw = true; } else { this.zookeeper = zk; } this.rootRegionTracker = new RootRegionTracker(zookeeper, throwableAborter); final CatalogTracker ct = this; // Override nodeDeleted so we get notified when meta node deleted this.metaNodeTracker = new MetaNodeTracker(zookeeper, throwableAborter) { public void nodeDeleted(String path) { if (!path.equals(node)) return; ct.resetMetaLocation(); } }; }
MetaNodeTracker getMetaNodeTracker() { return this.metaNodeTracker; }
CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, HConnection connection, Abortable abortable, final int defaultTimeout) throws IOException { this.connection = connection; if (abortable == null) { // A connection is abortable. this.abortable = this.connection; } Abortable throwableAborter = new Abortable() { @Override public void abort(String why, Throwable e) { throw new RuntimeException(why, e); } @Override public boolean isAborted() { return true; } }; if (zk == null) { // Create our own. Set flag so we tear it down on stop. this.zookeeper = new ZooKeeperWatcher(conf, "catalogtracker-on-" + connection.toString(), abortable); instantiatedzkw = true; } else { this.zookeeper = zk; } this.rootRegionTracker = new RootRegionTracker(zookeeper, throwableAborter); final CatalogTracker ct = this; // Override nodeDeleted so we get notified when meta node deleted this.metaNodeTracker = new MetaNodeTracker(zookeeper, throwableAborter) { public void nodeDeleted(String path) { if (!path.equals(node)) return; ct.resetMetaLocation(); } }; this.defaultTimeout = defaultTimeout; }
public CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf, HConnection connection, Abortable abortable, final int defaultTimeout) throws IOException { this.connection = connection; if (abortable == null) { // A connection is abortable. this.abortable = this.connection; } Abortable throwableAborter = new Abortable() { @Override public void abort(String why, Throwable e) { throw new RuntimeException(why, e); } @Override public boolean isAborted() { return true; } }; if (zk == null) { // Create our own. Set flag so we tear it down on stop. this.zookeeper = new ZooKeeperWatcher(conf, "catalogtracker-on-" + connection.toString(), abortable); instantiatedzkw = true; } else { this.zookeeper = zk; } this.rootRegionTracker = new RootRegionTracker(zookeeper, throwableAborter); final CatalogTracker ct = this; // Override nodeDeleted so we get notified when meta node deleted this.metaNodeTracker = new MetaNodeTracker(zookeeper, throwableAborter) { public void nodeDeleted(String path) { if (!path.equals(node)) return; ct.resetMetaLocation(); } }; this.defaultTimeout = defaultTimeout; }