list.remove(listener); if (list.size() == 0) { serviceListeners.remove(type);
synchronized (list) { list.remove(listener); if (list.size() == 0) { serviceListeners.remove(type); }
    public void removeServiceListener(String type, ServiceListener listener) {        type = type.toLowerCase();        LinkedList list = (LinkedList) serviceListeners.get(type);        if (list != null) {            list.remove(listener);            if (list.size() == 0) {                serviceListeners.remove(type);            }        }    }