use of org.goldenorb.zookeeper.OrbZKFailure in project goldenorb by jzachr.
the class OrbPartition method enterBarrier.
/**
*
* @param String
* barrierName
*/
private void enterBarrier(String barrierName) {
LOG.debug("p{} creating barrier {}", getPartitionID(), barrierName);
Barrier barrier = null;
synchronized (leaderGroupMembers) {
LOG.debug("{} will wait for {} partitions", barrierName, leaderGroupMembers.size());
barrier = new OrbFastBarrier(getOrbConf(), jobInProgressPath + "/" + barrierName, leaderGroupMembers.size(), Integer.toString(getPartitionID()), zk);
}
try {
barrier.enter();
LOG.debug("p{} entered {}", getPartitionID(), barrierName);
} catch (OrbZKFailure e) {
LOG.error("p{} failed to complete barrier {}: " + e.getMessage(), getPartitionID(), barrierName);
e.printStackTrace();
}
}
use of org.goldenorb.zookeeper.OrbZKFailure in project goldenorb by jzachr.
the class MockPartitionThread method launch.
// public MockPartitionThread() {
// thread = new Thread(this);
// }
@Override
public void launch(OutputStream outStream, OutputStream errStream) {
thread = new Thread(this);
partitionsPort = getOrbConf().getOrbBasePort() + processNum;
managerPort = getOrbConf().getOrbBasePort() + processNum + 100;
jobPath = "/GoldenOrb/" + getOrbConf().getOrbClusterName() + "/JobQueue/" + jobNumber;
jobInProgressPath = "/GoldenOrb/" + getOrbConf().getOrbClusterName() + "/JobsInProgress/" + jobNumber;
logger.info("jobPath: " + jobPath);
logger.info("jobInProgressPath: " + jobInProgressPath);
try {
zk = ZookeeperUtils.connect(getOrbConf().getOrbZooKeeperQuorum());
} catch (Exception e) {
logger.error("Unable to establish a connection with ZooKeeper" + getOrbConf().getOrbZooKeeperQuorum(), e);
}
OrbConfiguration jobConf = null;
try {
jobConf = (OrbConfiguration) ZookeeperUtils.getNodeWritable(zk, jobPath, OrbConfiguration.class, getOrbConf());
} catch (OrbZKFailure e) {
logger.error("Unable to retrieve job from ZooKeeper: " + jobPath, e);
}
if (jobConf != null) {
setOrbConf(jobConf);
}
thread.start();
}
use of org.goldenorb.zookeeper.OrbZKFailure in project goldenorb by jzachr.
the class OrbTrackerMemberDataServiceImpl method getOrbTrackerMemberData.
/**
* Returns the data of the OrbTrackerMember nodes under the LeaderGroup node in ZooKeeper.
*/
@Override
public OrbTrackerMemberData[] getOrbTrackerMemberData() throws ZooKeeperConnectionException, WatcherException, NodeDoesNotExistException {
if (zk == null) {
try {
initializeZooKeeper();
memberDataContainer = new HashMap<String, OrbTrackerMemberData>();
} catch (Exception e) {
e.printStackTrace();
throw new ZooKeeperConnectionException(e);
}
}
// Initialize leader group watcher
if (leaderGroupWatcher == null) {
try {
initializeLeaderGroupMonitor();
} catch (OrbZKFailure e) {
throw new WatcherException(e);
}
}
return memberDataContainer.values().toArray(new OrbTrackerMemberData[0]);
}
Aggregations