}
public void runImpl() {
if(listener == null)
return; //no need to do anything
NoSqlEntityManager mgr = factory.createEntityManager();
Cursor<KeyValue<WebNodeDbo>> cursor = WebNodeDbo.findAllNodes(mgr);
List<WebNodeDbo> all = new ArrayList<WebNodeDbo>();
List<WebNodeDbo> servers = new ArrayList<WebNodeDbo>();
while(cursor.next()) {
KeyValue<WebNodeDbo> kv = cursor.getCurrent();
WebNodeDbo val = kv.getValue();
all.add(val);
if(log.isDebugEnabled())
log.debug("checking node="+val.getWebServerName());
if(isServerUp(mgr, val)) {
if(log.isDebugEnabled())
log.debug("server is up="+val.getWebServerName());
servers.add(val);
}
if(val.getWebServerName().equals(config.getHostName())) {
if(log.isDebugEnabled())
log.debug("saving our node to be up="+val.getWebServerName());
saveNodeIsUp(mgr, val);
}
}
mgr.clear();
Collections.sort(servers, new ServerComparator());
int serverNumber = -1;
for(int i = 0; i < servers.size(); i++) {
WebNodeDbo node = servers.get(i);