avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/testcase LatchedThreadGroup.java
Date Wed, 20 Feb 2002 15:41:06 GMT
leif        02/02/20 07:41:06

  Modified:    src/java/org/apache/avalon/excalibur/testcase
                        LatchedThreadGroup.java
  Log:
  Workaround a strange compiler bug which shows its ugly head under
  javac (JDK 1.3) but not under jikes.
  
  Revision  Changes    Path
  1.2       +15 -4     jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/testcase/LatchedThreadGroup.java
  
  Index: LatchedThreadGroup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/testcase/LatchedThreadGroup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LatchedThreadGroup.java	12 Feb 2002 06:15:26 -0000	1.1
  +++ LatchedThreadGroup.java	20 Feb 2002 15:41:05 -0000	1.2
  @@ -12,6 +12,7 @@
   import org.apache.avalon.excalibur.testcase.CascadingAssertionFailedError;
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.logger.Logger;
   
   /**
    * This class is useful for writing MultiThreaded test cases where you need to perform
  @@ -23,7 +24,7 @@
    *  Runnables have completed.
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version $Id: LatchedThreadGroup.java,v 1.1 2002/02/12 06:15:26 leif Exp $
  + * @version $Id: LatchedThreadGroup.java,v 1.2 2002/02/20 15:41:05 leif Exp $
    */
   public class LatchedThreadGroup
       extends AbstractLogEnabled
  @@ -140,6 +141,16 @@
           return duration;
       }
       
  +    /**
  +     * Inner access method to getLogger() to work around a bug in the Javac compiler
  +     *  when getLogger() is called from the method of an inner class.  Jikes seems to
  +     *  handle it Ok. :-/
  +     */
  +    private Logger getInnerLogger()
  +    {
  +        return getLogger();
  +    }
  +    
       /*---------------------------------------------------------------
        * Inner Classes
        *-------------------------------------------------------------*/
  @@ -161,7 +172,7 @@
                   synchronized(m_semaphore)
                   {
                       m_startedCount++;
  -                    getLogger().debug( "Started " + m_startedCount + " test threads." );
  +                    getInnerLogger().debug( "Started " + m_startedCount + " test threads."
);
                       if ( m_startedCount >= m_threads.length )
                       {
                           m_semaphore.notifyAll();
  @@ -185,7 +196,7 @@
                   {
                       synchronized(m_semaphore)
                       {
  -                        getLogger().error( "Error in " + Thread.currentThread().getName(),
t );
  +                        getInnerLogger().error( "Error in " + Thread.currentThread().getName(),
t );
                           if ( m_exception != null )
                           {
                               m_exception = t;
  @@ -199,7 +210,7 @@
                   synchronized(m_semaphore)
                   {
                       m_completedCount++;
  -                    getLogger().debug( m_completedCount + " test threads completed." );
  +                    getInnerLogger().debug( m_completedCount + " test threads completed."
);
                       m_semaphore.notifyAll();
                   }
               }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message