private void startListenerThreadIfNewService ( URL url ) { String serviceName = url . getPath ( ) ; if ( ! lookupServices . containsKey ( serviceName ) ) { Long value = lookupServices . putIfAbsent ( serviceName , 0L ) ; if ( value == null ) { ServiceLookupThread lookupThread = new ServiceLookupThread ( serviceName ) ; lookupThread . setDaemon ( true ) ; lookupThread . start ( ) ; } } }
if new service registered start a new lookup thread each serviceName start a lookup thread to discover service