changeset 1996:d5c21ca9703e default tip

move threads to admin
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 04 Jul 2025 11:39:41 -0600
parents 301a6561fb6b
children
files host/admin/src/private/tools/java_threads.html.luan host/admin/src/private/tools/luan_threads.html.luan src/luan/modules/http/tools/Java_threads.luan src/luan/modules/http/tools/Luan_threads.luan
diffstat 4 files changed, 111 insertions(+), 121 deletions(-) [+]
line wrap: on
line diff
--- a/host/admin/src/private/tools/java_threads.html.luan	Fri Jul 04 10:25:38 2025 -0600
+++ b/host/admin/src/private/tools/java_threads.html.luan	Fri Jul 04 11:39:41 2025 -0600
@@ -1,1 +1,53 @@
-return require("luan:http/tools/Java_threads.luan").respond
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local Io = require "luan:Io.luan"
+local Time = require "luan:Time.luan"
+local Table = require "luan:Table.luan"
+local to_table = Table.java_to_table_shallow or error()
+local Http = require "luan:http/Http.luan"
+require "java"
+local Thread = require "java:java.lang.Thread"
+
+
+return function()
+	Io.stdout = Http.response.text_writer()
+
+	local threads = Thread.getAllStackTraces()
+	local threads = {}
+	for thread, trace in Luan.pairs(to_table(Thread.getAllStackTraces())) do
+		threads[#threads+1] = {
+			trace = trace
+			string = thread.toString()
+			state = thread.getState()
+		}
+	end
+%>
+<!doctype html>
+<html lang="en">
+	<body>
+		<h1>Java Threads</h1>
+		<p><%=Http.request.headers["host"]%> - <%=Time.format(Time.now())%></p>
+		<%
+		local count = 0
+		for _, thread in Luan.ipairs(threads) do
+			%>
+			<p><%=thread.string%> <%=thread.state%>
+			<ul>
+			<%
+			local trace = thread.trace
+			for i in Luan.range( 0 , trace.length - 1 ) do
+				local line = trace[i].toString()
+				%><li><%=line%></li><%
+			end
+			%>
+			</ul></p>
+			<%
+			count = count + 1
+		end
+		%>
+		<p><%=count%> threads found</p>
+
+	</body>
+</html>
+<%
+end
--- a/host/admin/src/private/tools/luan_threads.html.luan	Fri Jul 04 10:25:38 2025 -0600
+++ b/host/admin/src/private/tools/luan_threads.html.luan	Fri Jul 04 11:39:41 2025 -0600
@@ -1,1 +1,58 @@
-return require("luan:http/tools/Luan_threads.luan").respond
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local Table = require "luan:Table.luan"
+local java_to_table_shallow = Table.java_to_table_shallow or error()
+local Io = require "luan:Io.luan"
+local Time = require "luan:Time.luan"
+local Table = require "luan:Table.luan"
+local to_table = Table.java_to_table_shallow or error()
+local Http = require "luan:http/Http.luan"
+require "java"
+local Thread = require "java:java.lang.Thread"
+local LuanException = require "java:luan.LuanException"
+
+
+return function()
+	Io.stdout = Http.response.text_writer()
+
+	local threads = Thread.getAllStackTraces()
+	local threads = {}
+	for thread, trace in Luan.pairs(to_table(Thread.getAllStackTraces())) do
+		threads[#threads+1] = {
+			trace = trace
+			string = thread.toString()
+			state = thread.getState()
+		}
+	end
+%>
+<!doctype html>
+<html lang="en">
+	<body>
+		<h1>Luan Threads</h1>
+		<p><%=Http.request.headers["host"]%> - <%=Time.format(Time.now())%></p>
+		<%
+		local count = 0
+		for _, thread in Luan.ipairs(threads) do
+			local luan_trace = java_to_table_shallow(LuanException.justLuan(thread.trace))
+			if #luan_trace > 0 then
+				%>
+				<p><%=thread.string%> <%=thread.state%>
+				<ul>
+				<%
+				for i, el in Luan.ipairs(luan_trace) do
+					local line = LuanException.toLuanString(el);
+					%><li><%=line%></li><%
+				end
+				%>
+				</ul></p>
+				<%
+				count = count + 1
+			end
+		end
+		%>
+		<p><%=count%> threads found</p>
+
+	</body>
+</html>
+<%
+end
--- a/src/luan/modules/http/tools/Java_threads.luan	Fri Jul 04 10:25:38 2025 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-local Luan = require "luan:Luan.luan"
-local error = Luan.error
-local Io = require "luan:Io.luan"
-local Time = require "luan:Time.luan"
-local Table = require "luan:Table.luan"
-local to_table = Table.java_to_table_shallow or error()
-local Http = require "luan:http/Http.luan"
-require "java"
-local Thread = require "java:java.lang.Thread"
-
-
-local Java_threads = {}
-
-function Java_threads.respond()
-	Io.stdout = Http.response.text_writer()
-
-	local threads = Thread.getAllStackTraces()
-	local threads = {}
-	for thread, trace in Luan.pairs(to_table(Thread.getAllStackTraces())) do
-		threads[#threads+1] = {
-			trace = trace
-			string = thread.toString()
-			state = thread.getState()
-		}
-	end
-%>
-<!doctype html>
-<html lang="en">
-	<body>
-		<h1>Java Threads</h1>
-		<p><%=Http.request.headers["host"]%> - <%=Time.format(Time.now())%></p>
-		<%
-		local count = 0
-		for _, thread in Luan.ipairs(threads) do
-			%>
-			<p><%=thread.string%> <%=thread.state%>
-			<ul>
-			<%
-			local trace = thread.trace
-			for i in Luan.range( 0 , trace.length - 1 ) do
-				local line = trace[i].toString()
-				%><li><%=line%></li><%
-			end
-			%>
-			</ul></p>
-			<%
-			count = count + 1
-		end
-		%>
-		<p><%=count%> threads found</p>
-
-	</body>
-</html>
-<%
-end
-
-return Java_threads
--- a/src/luan/modules/http/tools/Luan_threads.luan	Fri Jul 04 10:25:38 2025 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-local Luan = require "luan:Luan.luan"
-local error = Luan.error
-local Table = require "luan:Table.luan"
-local java_to_table_shallow = Table.java_to_table_shallow or error()
-local Io = require "luan:Io.luan"
-local Time = require "luan:Time.luan"
-local Table = require "luan:Table.luan"
-local to_table = Table.java_to_table_shallow or error()
-local Http = require "luan:http/Http.luan"
-require "java"
-local Thread = require "java:java.lang.Thread"
-local LuanException = require "java:luan.LuanException"
-
-
-local Luan_threads = {}
-
-function Luan_threads.respond()
-	Io.stdout = Http.response.text_writer()
-
-	local threads = Thread.getAllStackTraces()
-	local threads = {}
-	for thread, trace in Luan.pairs(to_table(Thread.getAllStackTraces())) do
-		threads[#threads+1] = {
-			trace = trace
-			string = thread.toString()
-			state = thread.getState()
-		}
-	end
-%>
-<!doctype html>
-<html lang="en">
-	<body>
-		<h1>Luan Threads</h1>
-		<p><%=Http.request.headers["host"]%> - <%=Time.format(Time.now())%></p>
-		<%
-		local count = 0
-		for _, thread in Luan.ipairs(threads) do
-			local luan_trace = java_to_table_shallow(LuanException.justLuan(thread.trace))
-			if #luan_trace > 0 then
-				%>
-				<p><%=thread.string%> <%=thread.state%>
-				<ul>
-				<%
-				for i, el in Luan.ipairs(luan_trace) do
-					local line = LuanException.toLuanString(el);
-					%><li><%=line%></li><%
-				end
-				%>
-				</ul></p>
-				<%
-				count = count + 1
-			end
-		end
-		%>
-		<p><%=count%> threads found</p>
-
-	</body>
-</html>
-<%
-end
-
-return Luan_threads