final ServiceName finalGlobalName = globalName;
Runnable wait = new Runnable() {
@Override
public void run() {
ServiceSynchronizationManager mgr = ServiceSynchronizationManager.INSTANCE;
if (!mgr.waitForServiceRemove(serviceName,
DestinationUtils.destinationWaitTimeout())) {
log.warn("Timed out waiting for " + name + " pointer to stop.");
}
if (mgr.hasService(finalGlobalName) &&
!mgr.hasDependents(finalGlobalName)) {
if (!mgr.waitForServiceDown(finalGlobalName,
DestinationUtils.destinationWaitTimeout())) {
log.warn("Timed out waiting for " + name + " to stop.");
}
}