try { synchronized (lock) { lock.wait();
try { synchronized (lock) { if (!closed) { lock.wait(); }
    public void unregisterAllServices()    {        logger.finer("unregisterAllServices()");        if (services.size() == 0)        {            return;        }        Collection list;        synchronized (this)        {            list = new LinkedList(services.values());            services.clear();        }        for (Iterator iterator = list.iterator(); iterator.hasNext();)        {            ((ServiceInfo) iterator.next()).cancel();        }        Object lock = new Object();        new Canceler(list, lock).start();        // Remind: We get a livelock here, if the Canceler does not run!        try        {            synchronized (lock)            {                lock.wait();            }        }        catch (InterruptedException e)        {            // empty        }    }