| 68 | 1 package fschmidt.util.executor; | 
|  | 2 | 
|  | 3 | 
|  | 4 public final class JettyThreadPool implements org.eclipse.jetty.util.thread.ThreadPool { | 
|  | 5 	private final ThreadPool threadPool; | 
|  | 6 | 
|  | 7 	public JettyThreadPool(ThreadPool threadPool) { | 
|  | 8 		this.threadPool = threadPool; | 
|  | 9 	} | 
|  | 10 | 
|  | 11 	@Override public boolean dispatch(Runnable job) { | 
|  | 12 		return threadPool.dispatch(job); | 
|  | 13 	} | 
|  | 14 | 
|  | 15 	@Override public void join() throws InterruptedException { | 
|  | 16 		threadPool.join(); | 
|  | 17 	} | 
|  | 18 | 
|  | 19 	@Override public int getThreads() { | 
|  | 20 		return threadPool.getPoolSize(); | 
|  | 21 	} | 
|  | 22 | 
|  | 23 	@Override public int getIdleThreads() { | 
|  | 24 		return threadPool.getPoolSize() - threadPool.getActiveCount(); | 
|  | 25 	} | 
|  | 26 | 
|  | 27 	@Override public boolean isLowOnThreads() { | 
|  | 28 		return getIdleThreads() == 0; | 
|  | 29 	} | 
|  | 30 | 
|  | 31 } |