You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@apache.org on 2004/11/10 22:54:39 UTC

svn commit: rev 57387 - cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread

Author: giacomo
Date: Wed Nov 10 13:54:39 2004
New Revision: 57387

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/BoundedQueue.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/LinkedQueue.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/ThreadPool.java
Log:
fixing possible race condition

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/BoundedQueue.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/BoundedQueue.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/BoundedQueue.java	Wed Nov 10 13:54:39 2004
@@ -59,7 +59,7 @@
     /**
      * DOCUMENT ME!
      *
-     * @return
+     * @return 
      */
     public int getQueueSize(  )
     {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/LinkedQueue.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/LinkedQueue.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/LinkedQueue.java	Wed Nov 10 13:54:39 2004
@@ -32,11 +32,6 @@
     extends EDU.oswego.cs.dl.util.concurrent.LinkedQueue
     implements Queue
 {
-    //~ Instance fields --------------------------------------------------------
-
-    /** The size */
-    protected int m_size = 0;
-
     //~ Methods ----------------------------------------------------------------
 
     /**
@@ -44,31 +39,6 @@
      */
     public int getQueueSize(  )
     {
-        return m_size;
-    }
-
-    /**
-     * @see EDU.oswego.cs.dl.util.concurrent.LinkedQueue#extract()
-     */
-    protected synchronized Object extract(  )
-    {
-        synchronized( head_ )
-        {
-            if( head_.next != null )
-            {
-                --m_size;
-            }
-
-            return super.extract(  );
-        }
-    }
-
-    /**
-     * @see EDU.oswego.cs.dl.util.concurrent.LinkedQueue#insert(java.lang.Object)
-     */
-    protected void insert( final Object object )
-    {
-        super.insert( object );
-        ++m_size;
+        return -1;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/ThreadPool.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/ThreadPool.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/thread/ThreadPool.java	Wed Nov 10 13:54:39 2004
@@ -104,9 +104,10 @@
     int getPriority(  );
 
     /**
-     * Current size of the queue
+     * Current size of the queue.
      *
-     * @return current size of queue
+     * @return current size of queue. If the size of the queue is not
+     *         maintained by an implementation -1 should be returned.
      */
     int getQueueSize(  );