synchronized (mutex) {
if (getNodeName(taskId, superstep).equals(
pathToSuperstepZnode + "/" + lowest)) {
Stat s = zk.exists(pathToSuperstepZnode + "/" + highest,
new Watcher() {
@Override
public void process(WatchedEvent event) {
synchronized (mutex) {
LOG.debug("leaveBarrier() at superstep: " + superstep
+ " taskid:" + taskId.toString()
+ " highest notify lowest.");
mutex.notifyAll();
}
}
});
if (null != s) {
LOG.debug("leaveBarrier(): superstep:" + superstep + " taskid:"
+ taskId.toString() + " wait for higest notify.");
mutex.wait();
}
} else {
Stat s1 = zk.exists(getNodeName(taskId, superstep), false);
if (null != s1) {
try {
zk.delete(getNodeName(taskId, superstep), 0);
} catch (KeeperException.NoNodeException nne) {
LOG.warn("++++ Ignore because node may be dleted.", nne);
}
}
Stat s2 = zk.exists(pathToSuperstepZnode + "/" + lowest,
new Watcher() {
@Override
public void process(WatchedEvent event) {
synchronized (mutex) {
LOG.debug("leaveBarrier() at superstep: " + superstep
+ " taskid:" + taskId.toString()