diff --git a/Common/src/com/common/thread/ThreadService.java b/Common/src/com/common/thread/ThreadService.java index 6c8fa67..555f5ca 100644 --- a/Common/src/com/common/thread/ThreadService.java +++ b/Common/src/com/common/thread/ThreadService.java @@ -164,11 +164,11 @@ public class ThreadService { singleThreadedContext = null; target.run(); }//if// - else { - Debug.log("A target must be provided in order to run a reusable thread."); - }//else// +// else { +// Debug.log("A target must be provided in order to run a reusable thread."); +// }//else// }//try// - catch(Exception e) { + catch(Throwable e) { if(e instanceof InterruptedException) { return; }//if// diff --git a/Foundation Web Core/src/com/foundation/web/server/WebServer.java b/Foundation Web Core/src/com/foundation/web/server/WebServer.java index fbe20d1..3d6f1f3 100644 --- a/Foundation Web Core/src/com/foundation/web/server/WebServer.java +++ b/Foundation Web Core/src/com/foundation/web/server/WebServer.java @@ -1723,13 +1723,14 @@ public class WebServer { */ private class NetworkListener implements Runnable { private Selector selector = null; - private int maxThreadCount = 0; - private int activeThreadCount = 0; private Iterator selectedKeys = null; // private boolean hasListener = false; private volatile boolean stop = true; private volatile boolean hasRunnables = false; private LiteList runnables = new LiteList(10, 20); + private int maxThreadCount = 0; + private int activeThreadCount = 0; + private int threadId = 1; public NetworkListener(Selector selector, int maxThreadCount) { this.selector = selector; @@ -1752,6 +1753,9 @@ public class WebServer { if(stop) { stop = false; ThreadService.run(this); +// Thread t = new Thread(this); +// t.setName("Network Listener 1"); +// t.start(); }//if// }//start()// /** @@ -1901,10 +1905,10 @@ public class WebServer { try { if(((SocketChannel) channel).isOpen()) { synchronized(this) { - if(++activeThreadCount != maxThreadCount) { +// if(++activeThreadCount != maxThreadCount) { //Start another thread to take this thread's place.// ThreadService.run(this); - }//if// +// }//if// }//synchronized// if(isWrite) { @@ -1958,13 +1962,13 @@ public class WebServer { //Loop if the last thread to wait for a message couldn't start another thread due to the max number of threads allowed.// synchronized(this) { - if(activeThreadCount-- != maxThreadCount) { +// if(activeThreadCount-- != maxThreadCount) { loop = false; if(requiresWakeup) { selector.wakeup(); }//if// - }//if// +// }//if// }//synchronized// }//finally// }//else if//