Search in sources :

Example 1 with JobDeathEvent

use of org.goldenorb.event.job.JobDeathEvent in project goldenorb by jzachr.

the class JobManager method jobDeath.

/**
 * 
 * @param  OrbJob job
 */
private void jobDeath(OrbJob job) throws OrbZKFailure {
    logger.info("jobDeath " + job.getJobNumber());
    synchronized (job) {
        fireEvent(new JobDeathEvent(job.getJobNumber()));
        job.getJobStillActiveInterface().kill();
        job.getDeathAndCompleteWatcher().kill();
        job.getHeartbeatWatcher().kill();
    }
    for (OrbTrackerMember orbTrackerMember : orbTrackerMembers) {
        orbTrackerMember.killJob(job.getJobNumber());
    }
    logger.info("Shutting down partition instances");
    logger.info("Number of tries: " + job.getTries());
    if (job.getTries() > orbConf.getMaximumJobTries()) {
        ZookeeperUtils.recursiveDelete(zk, jobsInProgressPath + "/" + job.getJobNumber());
        ZookeeperUtils.deleteNodeIfEmpty(zk, jobsInProgressPath + "/" + job.getJobNumber());
        removeJobFromQueue(job);
    } else {
        ZookeeperUtils.recursiveDelete(zk, jobsInProgressPath + "/" + job.getJobNumber());
        ZookeeperUtils.deleteNodeIfEmpty(zk, jobsInProgressPath + "/" + job.getJobNumber());
        job.incrementTries();
        logger.info("Incrementing tries for: " + job.getJobNumber());
    }
    synchronized (activeJobs) {
        activeJobs.remove(job.getJobNumber());
        logger.info("Removing job: " + job.getJobNumber() + " from activeJobs.");
    // TODO tell the other OrbTrackers to kill the partitions associated with the job.
    }
    tryToLaunchJob();
}
Also used : OrbTrackerMember(org.goldenorb.jet.OrbTrackerMember) JobDeathEvent(org.goldenorb.event.job.JobDeathEvent)

Aggregations

JobDeathEvent (org.goldenorb.event.job.JobDeathEvent)1 OrbTrackerMember (org.goldenorb.jet.OrbTrackerMember)1