add buffering for the performance graph to avoid ConcurrentModificationException

closes: http://forum.yacy-websuche.de/viewtopic.php?f=6&t=628

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4281 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
fuchsi 17 years ago
parent 814aff60bd
commit a52681dd49

@ -26,6 +26,7 @@
package de.anomic.plasma; package de.anomic.plasma;
import java.util.ConcurrentModificationException;
import java.util.Iterator; import java.util.Iterator;
import de.anomic.server.serverProfiling; import de.anomic.server.serverProfiling;
@ -35,6 +36,8 @@ import de.anomic.ymage.ymageMatrix;
public class plasmaProfiling { public class plasmaProfiling {
private static ymageChart bufferChart = null;
public static long lastPPMUpdate = System.currentTimeMillis()- 30000; public static long lastPPMUpdate = System.currentTimeMillis()- 30000;
public static void updateIndexedPage(plasmaSwitchboardQueue.Entry entry) { public static void updateIndexedPage(plasmaSwitchboardQueue.Entry entry) {
@ -85,6 +88,7 @@ public class plasmaProfiling {
long time, now = System.currentTimeMillis(), bytes; long time, now = System.currentTimeMillis(), bytes;
int x0 = 1, x1, y0 = 0, y1, ppm; int x0 = 1, x1, y0 = 0, y1, ppm;
serverProfiling.Event event; serverProfiling.Event event;
try {
while (i.hasNext()) { while (i.hasNext()) {
event = (serverProfiling.Event) i.next(); event = (serverProfiling.Event) i.next();
time = event.time - now; time = event.time - now;
@ -113,6 +117,10 @@ public class plasmaProfiling {
if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x0, y0, x1, y1); if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x0, y0, x1, y1);
x0 = x1; y0 = y1; x0 = x1; y0 = y1;
} }
bufferChart = chart;
} catch (ConcurrentModificationException cme) {
chart = bufferChart;
}
return chart; return chart;
} }

Loading…
Cancel
Save