Message: The following issue has been closed.
Resolver: Niclas Hedhman Date: Sat, 4 Sep 2004 3:55 AM The amount of CPU cycles "wasted" is neglible. Combined with the extra "safety" against deadlocks, I intend to keep the current implementation. --------------------------------------------------------------------- View the issue: http://issues.apache.org/jira/browse/RUNTIME-51 Here is an overview of the issue: --------------------------------------------------------------------- Key: RUNTIME-51 Summary: SimpleFIFO in Merlin implementation wastes CPU cycles Type: Improvement Status: Closed Priority: Major Resolution: WON'T FIX Project: Merlin Runtime Components: CORE Versions: 3.4.0 Assignee: Stephen McConnell Reporter: Carel Paradis Created: Sun, 15 Aug 2004 1:22 PM Updated: Sat, 4 Sep 2004 3:55 AM Description: The class SimpleFifo in the Merlin 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\merlin\impl\src\java\org\apache\avalon\merlin\impl\SimpleFIFO.java Apply the following patch: // -----BEGIN PATCH Index: SimpleFIFO.java =================================================================== --- SimpleFIFO.java (revision 36413) +++ SimpleFIFO.java (working copy) @@ -42,7 +42,7 @@ synchronized( this ) { m_Queue.add( obj ); - notifyAll(); + notify(); } } @@ -52,7 +52,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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]