}
}
private void processAlive(String brokerName,String service){
if(selfService == null || !service.equals(selfService)){
AtomicLong lastKeepAlive=(AtomicLong) services.get(service);
if(lastKeepAlive==null){
brokers.put(service, brokerName);
if(discoveryListener!=null){
final DiscoveryEvent event=new DiscoveryEvent(service);
event.setBrokerName(brokerName);
// Have the listener process the event async so that
// he does not block this thread since we are doing time sensitive
// processing of events.
executor.execute(new Runnable() {
public void run() {
DiscoveryListener discoveryListener = MulticastDiscoveryAgent.this.discoveryListener;
if(discoveryListener!=null){
discoveryListener.onServiceAdd(event);
}
}
});
}
lastKeepAlive=new AtomicLong(System.currentTimeMillis());
services.put(service,lastKeepAlive);
doAdvertizeSelf();
}
lastKeepAlive.set(System.currentTimeMillis());
}
}