@Override public void removeWorker(String worker) { workers.remove(worker); if (jobFor(worker) != null) { try { clearJob(worker); } catch (Exception e) { log.warn("Unable to clear job for worker with id" + worker); } } }
@Override public void clearJob(String id) throws Exception { if (id == null) { log.warn("No job to clear; was null, returning"); return; } IAtomicReference<Job> jRef = h.getAtomicReference("job-" + id); if (jRef.isNull()) return; jRef.clear(); log.info("Destroyed job ref " + id); Job remove = null; for (Job j : jobs) { if (j.getWorkerId().equals(id)) { remove = j; break; } } jobs.remove(remove); }
/** * Updates the status of the worker to not needing replication * * @param workerId the worker id to update */ @Override public void doneReplicating(String workerId) { replicate.remove(workerId); }