Search in sources :

Example 6 with OrbZKFailure

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();
    }
}
Also used : OrbFastBarrier(org.goldenorb.zookeeper.OrbFastBarrier) OrbZKFailure(org.goldenorb.zookeeper.OrbZKFailure) OrbFastAllDoneBarrier(org.goldenorb.zookeeper.OrbFastAllDoneBarrier) AllDoneBarrier(org.goldenorb.zookeeper.AllDoneBarrier) OrbFastBarrier(org.goldenorb.zookeeper.OrbFastBarrier) Barrier(org.goldenorb.zookeeper.Barrier)

Example 7 with OrbZKFailure

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();
}
Also used : OrbConfiguration(org.goldenorb.conf.OrbConfiguration) OrbZKFailure(org.goldenorb.zookeeper.OrbZKFailure) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Example 8 with OrbZKFailure

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]);
}
Also used : OrbTrackerMemberData(org.goldenorb.client.OrbTrackerMemberData) OrbZKFailure(org.goldenorb.zookeeper.OrbZKFailure) ZooKeeperConnectionException(org.goldenorb.client.ZooKeeperConnectionException) ZooKeeperConnectionException(org.goldenorb.client.ZooKeeperConnectionException) IOException(java.io.IOException) WatcherException(org.goldenorb.client.WatcherException) NodeDoesNotExistException(org.goldenorb.client.NodeDoesNotExistException) WatcherException(org.goldenorb.client.WatcherException)

Aggregations

OrbZKFailure (org.goldenorb.zookeeper.OrbZKFailure)8 AllDoneBarrier (org.goldenorb.zookeeper.AllDoneBarrier)3 OrbFastAllDoneBarrier (org.goldenorb.zookeeper.OrbFastAllDoneBarrier)3 IOException (java.io.IOException)2 KeeperException (org.apache.zookeeper.KeeperException)2 OrbConfiguration (org.goldenorb.conf.OrbConfiguration)2 OrbExceptionEvent (org.goldenorb.event.OrbExceptionEvent)2 Barrier (org.goldenorb.zookeeper.Barrier)2 OrbFastBarrier (org.goldenorb.zookeeper.OrbFastBarrier)2 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LongWritable (org.apache.hadoop.io.LongWritable)1 InvalidJobConfException (org.apache.hadoop.mapred.InvalidJobConfException)1 NodeDoesNotExistException (org.goldenorb.client.NodeDoesNotExistException)1 OrbTrackerMemberData (org.goldenorb.client.OrbTrackerMemberData)1 WatcherException (org.goldenorb.client.WatcherException)1 ZooKeeperConnectionException (org.goldenorb.client.ZooKeeperConnectionException)1 PartitionRequest (org.goldenorb.jet.PartitionRequest)1