Mercurial Hosting > nabble
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 67:9d0fefce6985 | 68:00520880ad02 |
|---|---|
| 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 } |
