logger.debug("considert starting "+w);
if (w.active==false){
logger.debug(w.name + " is non active");
return;
}
WriteLock l = null;
try {
l = new WriteLock(zk, "/ironcount/workloads/" + w.name,null);
l.lock();
List<String> children = zk.getChildren("/ironcount/workloads/" + w.name, false);
if (children.size() <= w.maxWorkers){
WorkerThread wt = new WorkerThread(this,w);
this.executor.submit(wt);
this.workerThreads.put(wt, new Object());
logger.debug("Started worker thread "+wt+ " "+w);
}
} catch (KeeperException ex) {
throw new RuntimeException(ex);
}
catch (InterruptedException ex) {
throw new RuntimeException(ex);
} catch (Throwable t){
t.printStackTrace(System.err);
logger.error(t);
throw new RuntimeException (t);
} finally {
l.unlock();
}
}