view 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 source

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;
	}

}