String[] groups,
LookupLocator[] locators,
DiscoveryListener listener,
Configuration config) throws IOException {
LookupDiscoveryManager ldm ;
synchronized(this) {
DiscoveryControl discoControl = getDiscoveryControl(sharedName);
if(discoControl==null) {
discoControl = new DiscoveryControl(sharedName);
pool.add(discoControl);
if(logger.isDebugEnabled())
logger.debug("Create new DiscoveryControl for [{}]", sharedName);
} else {
if(logger.isDebugEnabled())
logger.debug("DiscoveryControl obtained for [{}]", sharedName);
}
ldm = discoControl.getLookupDiscoveryManager(groups, locators);
if(ldm==null) {
ldm = discoControl.createLookupDiscoveryManager(groups, locators, listener, config);
} else {
((SharedDiscoveryManager)ldm).incrementRefCounter();
if(listener!=null)
ldm.addDiscoveryListener(listener);
}
}
return(ldm);
}