diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.java
index 14ee3c8f7..a3e54b3b9 100644
--- a/htroot/Threaddump_p.java
+++ b/htroot/Threaddump_p.java
@@ -51,13 +51,17 @@
import de.anomic.data.htmlTools;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.server.serverFileUtils;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.tools.nxTools;
import de.anomic.yacy.yacyVersion;
import java.util.Map;
import java.lang.StringBuffer;
import java.util.Date;
+import java.io.File;
+import java.io.IOException;
public class Threaddump_p {
@@ -78,18 +82,18 @@ public class Threaddump_p {
String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
buffer.append("************* Start Thread Dump " + dt + " *******************").append("
");
- buffer.append("
YaCy Version: " + versionstring + "
");
+ buffer.append("
YaCy Version: " + versionstring + "
");
buffer.append("Total Memory = " + (Runtime.getRuntime().totalMemory())).append("
");
buffer.append("Used Memory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())).append("
");
buffer.append("Free Memory = " + (Runtime.getRuntime().freeMemory())).append("
");
buffer.append(" --- --- --- ---
");
- appendStackTraces(buffer, stackTraces, Thread.State.BLOCKED);
- appendStackTraces(buffer, stackTraces, Thread.State.RUNNABLE);
- appendStackTraces(buffer, stackTraces, Thread.State.TIMED_WAITING);
- appendStackTraces(buffer, stackTraces, Thread.State.WAITING);
- appendStackTraces(buffer, stackTraces, Thread.State.NEW);
- appendStackTraces(buffer, stackTraces, Thread.State.TERMINATED);
+ appendStackTraces(sb.getRootPath(), buffer, stackTraces, Thread.State.BLOCKED);
+ appendStackTraces(sb.getRootPath(), buffer, stackTraces, Thread.State.RUNNABLE);
+ appendStackTraces(sb.getRootPath(), buffer, stackTraces, Thread.State.TIMED_WAITING);
+ appendStackTraces(sb.getRootPath(), buffer, stackTraces, Thread.State.WAITING);
+ appendStackTraces(sb.getRootPath(), buffer, stackTraces, Thread.State.NEW);
+ appendStackTraces(sb.getRootPath(), buffer, stackTraces, Thread.State.TERMINATED);
buffer.append("************* End Thread Dump " + dt + " *******************").append("
");
@@ -101,19 +105,46 @@ public class Threaddump_p {
return prop; // return from serverObjects respond()
}
- private static void appendStackTraces(StringBuffer buffer, Map stackTraces, Thread.State stateIn) {
+ private static void appendStackTraces(File rootPath, StringBuffer buffer, Map stackTraces, Thread.State stateIn) {
buffer.append("THREADS WITH STATES: " + stateIn.toString()).append("
").append("
");
+ File classPath = new File(rootPath, "source");
for (Thread thread: stackTraces.keySet()) {
- StackTraceElement[] stackTraceElement = stackTraces.get(thread);
+ StackTraceElement[] stackTraceElements = stackTraces.get(thread);
+ StackTraceElement ste;
+ String line;
if (stateIn.equals(thread.getState())) {
buffer.append("Thread= " + thread.getName() + " " + (thread.isDaemon()?"daemon":"") + " id=" + thread.getId() + " " + thread.getState().toString()).append("
");
- for (int i = 0; i < stackTraceElement.length; i++) {
- buffer.append("at " + htmlTools.encodeUnicode2html(stackTraceElement[i].toString(), true)).append("
");
+ for (int i = 0; i < stackTraceElements.length; i++) {
+ ste = stackTraceElements[i];
+ if (i == 0) {
+ line = getLine(classPath, ste.getClassName(), ste.getLineNumber());
+ } else {
+ line = null;
+ }
+ if ((line != null) && (line.length() > 0)) {
+ buffer.append("at " + htmlTools.encodeUnicode2html(ste.toString(), true)).append(" [").append(line).append("]
");
+ } else {
+ buffer.append("at " + htmlTools.encodeUnicode2html(ste.toString(), true)).append("
");
+ }
}
buffer.append("
");
}
}
buffer.append("
");
}
+
+ private static String getLine(File sourcePath, String classname, int line) {
+ // find class
+ String classPath = classname.replace('.', '/') + ".java";
+ File file = new File(sourcePath, classPath);
+ if (!file.exists()) return "";
+ try {
+ String lineString = nxTools.line(serverFileUtils.read(file), line);
+ if (lineString == null) return "@ERROR";
+ return lineString;
+ } catch (IOException e) {
+ return "@EXCEPTION: " + e.getMessage();
+ }
+ }
}
diff --git a/source/de/anomic/kelondro/kelondroRowCollection.java b/source/de/anomic/kelondro/kelondroRowCollection.java
index cdd7fd754..99ab1c9d5 100644
--- a/source/de/anomic/kelondro/kelondroRowCollection.java
+++ b/source/de/anomic/kelondro/kelondroRowCollection.java
@@ -52,15 +52,12 @@ public class kelondroRowCollection {
static final Integer dummy = new Integer(0);
public static ExecutorService sortingthreadexecutor = null;
- public static CompletionService