HBASE-3172 Reverse order of AssignmentManager and MetaNodeTracker in ZooKeeperWatcher

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1028911 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-10-29 21:32:11 +00:00
parent 022f70b722
commit 8379057874
3 changed files with 16 additions and 4 deletions

View File

@ -624,6 +624,8 @@ Release 0.21.0 - Unreleased
and assorted fixes around this + TestRollingRestart added
HBASE-3160 Use more intelligent priorities for PriorityCompactionQueue
(Nicolas Spiegelberg via Stack)
HBASE-3172 Reverse order of AssignmentManager and MetaNodeTracker in
ZooKeeperWatcher
IMPROVEMENTS

View File

@ -342,7 +342,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
this.assignmentManager = new AssignmentManager(this, serverManager,
this.catalogTracker, this.executorService);
zooKeeper.registerListener(assignmentManager);
zooKeeper.registerListenerFirst(assignmentManager);
this.regionServerTracker = new RegionServerTracker(zooKeeper, this,
this.serverManager);

View File

@ -21,8 +21,9 @@ package org.apache.hadoop.hbase.zookeeper;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -64,8 +65,8 @@ public class ZooKeeperWatcher implements Watcher, Abortable {
private Abortable abortable;
// listeners to be notified
private final Set<ZooKeeperListener> listeners =
new CopyOnWriteArraySet<ZooKeeperListener>();
private final List<ZooKeeperListener> listeners =
new CopyOnWriteArrayList<ZooKeeperListener>();
// set of unassigned nodes watched
private Set<String> unassignedNodes = new HashSet<String>();
@ -200,6 +201,15 @@ public class ZooKeeperWatcher implements Watcher, Abortable {
listeners.add(listener);
}
/**
* Register the specified listener to receive ZooKeeper events and add it as
* the first in the list of current listeners.
* @param listener
*/
public void registerListenerFirst(ZooKeeperListener listener) {
listeners.add(0, listener);
}
/**
* Get the connection to ZooKeeper.
* @return connection reference to zookeeper