diff src/fschmidt/util/executor/JettyThreadPool.java @ 68:00520880ad02

add fschmidt source
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 05 Oct 2025 17:24:15 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/fschmidt/util/executor/JettyThreadPool.java	Sun Oct 05 17:24:15 2025 -0600
@@ -0,0 +1,31 @@
+package fschmidt.util.executor;
+
+
+public final class JettyThreadPool implements org.eclipse.jetty.util.thread.ThreadPool {
+	private final ThreadPool threadPool;
+
+	public JettyThreadPool(ThreadPool threadPool) {
+		this.threadPool = threadPool;
+	}
+
+	@Override public boolean dispatch(Runnable job) {
+		return threadPool.dispatch(job);
+	}
+
+	@Override public void join() throws InterruptedException {
+		threadPool.join();
+	}
+
+	@Override public int getThreads() {
+		return threadPool.getPoolSize();
+	}
+
+	@Override public int getIdleThreads() {
+		return threadPool.getPoolSize() - threadPool.getActiveCount();
+	}
+
+	@Override public boolean isLowOnThreads() {
+		return getIdleThreads() == 0;
+	}
+
+}