removed unnecessary cleanup method

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4625 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 76eac114ed
commit b2150057d2

@ -97,7 +97,7 @@ public class CrawlProfileEditor_p {
sb.profilesPassiveCrawls.removeEntry(handle);
}
if (post.containsKey("deleteTerminatedProfiles")) {
Iterator profiles = sb.profilesPassiveCrawls.profiles(false);
Iterator<plasmaCrawlProfile.entry> profiles = sb.profilesPassiveCrawls.profiles(false);
while (profiles.hasNext()) {
profiles.next();
profiles.remove();
@ -111,7 +111,7 @@ public class CrawlProfileEditor_p {
Iterator<plasmaCrawlProfile.entry> it = sb.profilesActiveCrawls.profiles(true);
entry selentry;
while (it.hasNext()) {
selentry = (entry)it.next();
selentry = it.next();
if (selentry.name().equals(plasmaSwitchboard.CRAWL_PROFILE_PROXY) ||
selentry.name().equals(plasmaSwitchboard.CRAWL_PROFILE_REMOTE) /*||
selentry.name().equals(plasmaSwitchboard.CRAWL_PROFILE_SNIPPET_TEXT) ||
@ -153,7 +153,7 @@ public class CrawlProfileEditor_p {
// put active crawls into list
it = sb.profilesActiveCrawls.profiles(true);
while (it.hasNext()) {
profile = (plasmaCrawlProfile.entry) it.next();
profile = it.next();
putProfileEntry(prop, profile, true, dark, count, domlistlength);
dark = !dark;
count++;
@ -162,7 +162,7 @@ public class CrawlProfileEditor_p {
boolean existPassiveCrawls = false;
it = sb.profilesPassiveCrawls.profiles(true);
while (it.hasNext()) {
profile = (plasmaCrawlProfile.entry) it.next();
profile = it.next();
putProfileEntry(prop, profile, false, dark, count, domlistlength);
dark = !dark;
count++;

@ -35,14 +35,13 @@ public class serverProfiling extends Thread {
private static Map<String, TreeMap<Long, Event>> historyMaps; // key=name of history, value=TreeMap of Long/Event
private static Map<String, Integer> eventCounter; // key=name of history, value=Integer of event counter
private static long lastCompleteCleanup;
private static serverProfiling systemProfiler;
static {
// initialize profiling
historyMaps = new ConcurrentHashMap<String, TreeMap<Long, Event>>();
eventCounter = new ConcurrentHashMap<String, Integer>();
lastCompleteCleanup = System.currentTimeMillis();
//lastCompleteCleanup = System.currentTimeMillis();
systemProfiler = null;
}
@ -87,33 +86,11 @@ public class serverProfiling extends Thread {
// clean up too old entries
cleanup(history);
cleanup();
// store map
historyMaps.put(eventName, history);
}
private static void cleanup() {
if (System.currentTimeMillis() - lastCompleteCleanup < 600000) return;
Object[] historyNames = historyMaps.keySet().toArray();
for (int i = 0; i < historyNames.length; i++) {
cleanup((String) historyNames[i]);
}
lastCompleteCleanup = System.currentTimeMillis();
}
private static void cleanup(String eventName) {
if (historyMaps.containsKey(eventName)) {
TreeMap<Long, Event> history = historyMaps.get(eventName);
cleanup(history);
if (history.size() > 0) {
historyMaps.put(eventName, history);
} else {
historyMaps.remove(eventName);
}
}
}
private static void cleanup(TreeMap<Long, Event> history) {
// clean up too old entries
while (history.size() > 0) {

Loading…
Cancel
Save