You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by de...@avalon.apache.org on 2004/08/15 22:51:20 UTC

[jira] Closed: (RUNTIME-52) SimpleFIFO in Merlin model composition wastes CPU cycles

Message:

   The following issue has been closed.

   Resolver: Niclas Hedhman
       Date: Sun, 15 Aug 2004 1:50 PM

I am a bit paranoid about deadlocks, so I stick to things that I have proven to myself works in the long-run (months/years). And since there is no measurable performance degradation, I think we should stick with the 'safety net'.
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/RUNTIME-52

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: RUNTIME-52
    Summary: SimpleFIFO in Merlin model composition wastes CPU cycles
       Type: Improvement

     Status: Closed
   Priority: Major
 Resolution: WON'T FIX

    Project: Merlin Runtime
 Components: 
             COMPOSITION
   Versions:
             3.4.0

   Assignee: Niclas Hedhman
   Reporter: Carel Paradis

    Created: Sun, 15 Aug 2004 1:28 PM
    Updated: Sun, 15 Aug 2004 1:50 PM

Description:
The class SimpleFifo in the Merlin Model implementation wastes CPU cycles every 100 ms. The method get verify if the queue is no longer empty every 100 ms instead of waiting to be notified when a new element is added to the queue. Also, the put method notifies all waiting threads instead of notifying only one thread. It is not necessary to notify all threads because if many threads are waiting, then only one can get the newly added element.

The following file must be updated: trunk\runtime\composition\impl\src\java\org\apache\avalon\composition\model\impl\SimpleFIFO.java

Apply the following patch:

// -----BEGIN PATCH
Index: SimpleFIFO.java
===================================================================
--- SimpleFIFO.java	(revision 36413)
+++ SimpleFIFO.java	(working copy)
@@ -48,7 +48,7 @@
         synchronized( this )
         {
             m_Queue.add( obj );
-            notifyAll();
+            notify();
         }
     }
     
@@ -58,7 +58,7 @@
         synchronized( this )
         {
             while( m_Queue.size() == 0 )
-                wait(100);
+                wait();
             return m_Queue.remove(0);
         }
     }
// -----END PATCH



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org