costin 01/04/21 11:10:52 Modified: src/share/org/apache/tomcat/util/collections Queue.java Log: Added a method to stop the Queue from waiting ( and blocking the log thread ). Part of 1418 fix. Revision Changes Path 1.2 +16 -2 jakarta-tomcat/src/share/org/apache/tomcat/util/collections/Queue.java Index: Queue.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/collections/Queue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Queue.java 2000/12/07 19:52:51 1.1 +++ Queue.java 2001/04/21 18:10:52 1.2 @@ -67,7 +67,9 @@ */ public class Queue { private Vector vector = new Vector(); - + private boolean stopWaiting=false; + private boolean waiting=false; + /** * Put the object into the queue. * @@ -78,17 +80,29 @@ vector.addElement(object); notify(); } + + /** Break the pull(), allowing the calling thread to exit + */ + public synchronized void stop() { + stopWaiting=true; + // just a hack to stop waiting + if( waiting ) notify(); + } /** * Pull the first object out of the queue. Wait if the queue is * empty. */ public synchronized Object pull() { - while (isEmpty()) + while (isEmpty()) { try { + waiting=true; wait(); } catch (InterruptedException ex) { } + waiting=false; + if( stopWaiting ) return null; + } return get(); }