gcCounter++; if (gcCounter - 30 == 0) { gcCounter = 0; if (logger.isEnabledFor(Level.DEBUG)) { Runtime runtime = Runtime.getRuntime(); float freeMemoryOld = (float) runtime.freeMemory(); runtime.gc(); float freeMemoryNew = (float) runtime.freeMemory(); logger.debug(String.valueOf( (int) (freeMemoryNew - freeMemoryOld) / 1024) + "K freed"); } else { Runtime.getRuntime().gc(); } }
    private void updateIDs() {        try {            NodeList nodes = document.getElementsByTagName("removed");            if (nodes == null || nodes.getLength() == 0) {                return;            }            nodes = nodes.item(0).getChildNodes();            if (nodes == null || nodes.getLength() == 0) {                return;            }            Element e = null;            String id = null;            int size = nodes.getLength();            String toRemoveKey;            DownloadDO downloadDO;            DownloadSourceDO[] sourcen;            for (int i = 0; i < size; i++) {                if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE) {                    e = (Element) nodes.item(i);                    id = e.getAttribute("id");                    toRemoveKey = id;                    if (uploadMap.containsKey(toRemoveKey)) {                        uploadMap.remove(toRemoveKey);                        continue;                    }                    else if (downloadMap.containsKey(toRemoveKey)) {                        downloadDO = (DownloadDO) downloadMap.get(                            sourcenZuDownloads.get(toRemoveKey));                        if (downloadDO != null) {                            sourcen = downloadDO.getSources();                            if (sourcen != null) {                                for (int y = 0; y < sourcen.length; y++) {                                    sourcenZuDownloads.remove(Integer.toString(                                        sourcen[y].getId()));                                }                            }                        }                        downloadMap.remove(toRemoveKey);                        continue;                    }                    else if (serverMap.containsKey(toRemoveKey)) {                        serverMap.remove(toRemoveKey);                        continue;                    }                    else if (sourcenZuDownloads.containsKey(toRemoveKey)) {                        downloadDO = (DownloadDO) sourcenZuDownloads.get(                            toRemoveKey);                        downloadDO.removeSource(id);                        sourcenZuDownloads.remove(toRemoveKey);                        continue;                    }                    else if (searchMap.containsKey(toRemoveKey)) {                        searchMap.remove(toRemoveKey);                        Search.currentSearchCount = searchMap.size();                        continue;                    }                }            }            gcCounter++;            if (gcCounter - 30 == 0) {                gcCounter = 0;                if (logger.isEnabledFor(Level.DEBUG)) {                    Runtime runtime = Runtime.getRuntime();                    float freeMemoryOld = (float) runtime.freeMemory();                    runtime.gc();                    float freeMemoryNew = (float) runtime.freeMemory();                    logger.debug(String.valueOf( (int) (freeMemoryNew -                        freeMemoryOld) / 1024) + "K freed");                }                else {                    Runtime.getRuntime().gc();                }            }        }        catch (Exception e) {            if (logger.isEnabledFor(Level.ERROR)) {                logger.error("Unbehandelte Exception", e);            }        }    }