- better thread dump

- suppressed one server exception

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6509 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 9743b70d1c
commit f4946eaf27

@ -33,6 +33,8 @@ import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Map.Entry;
import java.util.ArrayList;
import java.util.HashMap;
@ -113,12 +115,12 @@ public class Threaddump_p {
bufferappend(buffer, plain, "THREADS WITH STATES: " + stateIn.toString());
bufferappend(buffer, plain, "");
// collect single dumps
HashMap<String, ArrayList<String>> dumps = dumpCollection(rootPath, stackTraces, plain, stateIn);
HashMap<String, SortedSet<String>> dumps = dumpCollection(rootPath, stackTraces, plain, stateIn);
// write dumps
for (final Entry<String, ArrayList<String>> entry: dumps.entrySet()) {
ArrayList<String> threads = entry.getValue();
for (int i = 0; i < threads.size(); i++) bufferappend(buffer, plain, threads.get(i));
for (final Entry<String, SortedSet<String>> entry: dumps.entrySet()) {
SortedSet<String> threads = entry.getValue();
for (String t: threads) bufferappend(buffer, plain, t);
bufferappend(buffer, plain, entry.getKey());
bufferappend(buffer, plain, "");
}
@ -155,12 +157,12 @@ public class Threaddump_p {
private static HashMap<String, Integer> dumpStatistic(final File rootPath, final ArrayList<Map<Thread,StackTraceElement[]>> stackTraces, final boolean plain, final Thread.State stateIn) {
Map<Thread,StackTraceElement[]> trace;
HashMap<String, Integer> result = new HashMap<String, Integer>();
HashMap<String, ArrayList<String>> x;
HashMap<String, SortedSet<String>> x;
int count;
for (int i = 0; i < stackTraces.size(); i++) {
trace = stackTraces.get(i);
x = dumpCollection(rootPath, trace, plain, stateIn);
for (final Entry<String, ArrayList<String>> e: x.entrySet()) {
for (final Entry<String, SortedSet<String>> e: x.entrySet()) {
Integer c = result.get(e.getKey());
count = e.getValue().size();
if (c == null) result.put(e.getKey(), Integer.valueOf(count));
@ -173,12 +175,12 @@ public class Threaddump_p {
return result;
}
private static HashMap<String, ArrayList<String>> dumpCollection(final File rootPath, final Map<Thread,StackTraceElement[]> stackTraces, final boolean plain, final Thread.State stateIn) {
private static HashMap<String, SortedSet<String>> dumpCollection(final File rootPath, final Map<Thread,StackTraceElement[]> stackTraces, final boolean plain, final Thread.State stateIn) {
final File classPath = new File(rootPath, "source");
Thread thread;
// collect single dumps
HashMap<String, ArrayList<String>> dumps = new HashMap<String, ArrayList<String>>();
HashMap<String, SortedSet<String>> dumps = new HashMap<String, SortedSet<String>>();
for (final Entry<Thread, StackTraceElement[]> entry: stackTraces.entrySet()) {
thread = entry.getKey();
final StackTraceElement[] stackTraceElements = entry.getValue();
@ -220,8 +222,8 @@ public class Threaddump_p {
}
}
String threaddump = sb.toString();
ArrayList<String> threads = dumps.get(threaddump);
if (threads == null) threads = new ArrayList<String>();
SortedSet<String> threads = dumps.get(threaddump);
if (threads == null) threads = new TreeSet<String>();
threads.add(threadtitle);
dumps.put(threaddump, threads);
}

@ -869,7 +869,7 @@ public final class serverCore extends AbstractBusyThread implements BusyThread {
return null;
} catch (final IOException e) {
String message = e.getMessage();
if (logerr && !message.equals("Socket closed") && !message.equals("Connection reset")) Log.logWarning("SERVER", "receive closed by IOException: " + e.getMessage());
if (logerr && !message.equals("Socket closed") && !message.equals("Connection reset") && !message.equals("Read timed out")) Log.logWarning("SERVER", "receive closed by IOException: " + e.getMessage());
return null;
} finally {
try {

Loading…
Cancel
Save