@Override public void addWorker(String worker) { heartbeat.put(worker, System.currentTimeMillis()); if (!workers.contains(worker)) { log.info("Adding worker " + worker); workers.add(worker); log.info("Number of workers is now " + workers.size()); } }
/** * Tracks worker ids that need state replication * * @param workerId the worker id to replicate * @return the list of worker ids that need state replication */ @Override public boolean needsReplicate(String workerId) { return replicate.contains(workerId); }
@Override public void availableForWork(String id) { if (!workers.contains(id)) workers.add(id); }
/** * Adds a worker to the list to be replicate d * * @param workerId the worker id to add */ @Override public void addReplicate(String workerId) { if (!replicate.contains(workerId)) replicate.add(workerId); }