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/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/gui ProfilerFrame.java ProfileSampleFrame.java
Date Wed, 13 Mar 2002 09:05:20 GMT
leif        02/03/13 01:05:20

  Modified:    src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/gui
                        ProfilerFrame.java ProfileSampleFrame.java
  Log:
  Modified so that each ProfileSampleFrame does not need its own Thread.
  
  Revision  Changes    Path
  1.7       +43 -1     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/gui/ProfilerFrame.java
  
  Index: ProfilerFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/gui/ProfilerFrame.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProfilerFrame.java	5 Mar 2002 13:28:45 -0000	1.6
  +++ ProfilerFrame.java	13 Mar 2002 09:05:20 -0000	1.7
  @@ -31,6 +31,7 @@
   import org.apache.avalon.excalibur.altprofile.profiler.ProfilePointDescriptor;
   import org.apache.avalon.excalibur.altprofile.profiler.ProfileSampleDescriptor;
   
  +import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
  @@ -42,11 +43,12 @@
   /**
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.6 $ $Date: 2002/03/05 13:28:45 $
  + * @version CVS $Revision: 1.7 $ $Date: 2002/03/13 09:05:20 $
    * @since 4.1
    */
   public class ProfilerFrame
       extends JFrame
  +    implements Runnable, Disposable
   {
       private String m_title;
       private ProfilerManager m_profilerManager;
  @@ -57,6 +59,8 @@
       private File m_desktopFile;
       private File m_desktopFileDir;
       
  +    private Thread m_runner;
  +    
       /*---------------------------------------------------------------
        * Constructors
        *-------------------------------------------------------------*/
  @@ -76,6 +80,44 @@
           m_profilerManager = profilerManager;
           
           init();
  +        
  +        m_runner = new Thread( this, "ProfilerFrameRunner" );
  +        m_runner.start();
  +    }
  +    
  +    /*---------------------------------------------------------------
  +     * Runnable Methods
  +     *-------------------------------------------------------------*/
  +    public void run()
  +    {
  +        while( m_runner != null )
  +        {
  +            try
  +            {
  +                Thread.sleep( 1000 );
  +            }
  +            catch ( InterruptedException e ) {}
  +            
  +            // Update each of the ProfileSampleFrames.  This is kind of temporary
  +            //  to get rid of the one thread per frame issue.
  +            JInternalFrame[] frames = m_desktopPane.getAllFrames();
  +            for (int i = 0; i < frames.length; i++)
  +            {
  +                JInternalFrame frame = frames[i];
  +                if ( frame instanceof ProfileSampleFrame )
  +                {
  +                    ((ProfileSampleFrame)frame).update();
  +                }
  +            }
  +        }
  +    }
  +        
  +    /*---------------------------------------------------------------
  +     * Disposable Methods
  +     *-------------------------------------------------------------*/
  +    public void dispose()
  +    {
  +        m_runner = null;
       }
       
       /*---------------------------------------------------------------
  
  
  
  1.5       +2 -26     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/gui/ProfileSampleFrame.java
  
  Index: ProfileSampleFrame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/gui/ProfileSampleFrame.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProfileSampleFrame.java	5 Mar 2002 10:17:11 -0000	1.4
  +++ ProfileSampleFrame.java	13 Mar 2002 09:05:20 -0000	1.5
  @@ -28,12 +28,12 @@
   /**
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2002/03/05 10:17:11 $
  + * @version CVS $Revision: 1.5 $ $Date: 2002/03/13 09:05:20 $
    * @since 4.1
    */
   class ProfileSampleFrame
       extends AbstractInternalFrame
  -    implements ProfileSampleListener, Runnable
  +    implements ProfileSampleListener
   {
       public static final String FRAME_TYPE = "sample-frame";
       
  @@ -41,8 +41,6 @@
       private ProfilerManager m_profilerManager;
       private LineChart m_lineChart;
       
  -    private Thread m_runner;
  -    
       /*---------------------------------------------------------------
        * Constructors
        *-------------------------------------------------------------*/
  @@ -140,29 +138,10 @@
       {
           m_descriptor.removeProfileSampleListener( this );
           
  -        m_runner = null;
  -        
           super.internalFrameClosed( event );
       }
       
       /*---------------------------------------------------------------
  -     * Runnable Methods
  -     *-------------------------------------------------------------*/
  -    public void run()
  -    {
  -        while( m_runner != null )
  -        {
  -            try
  -            {
  -                Thread.sleep( 1000 );
  -            }
  -            catch ( InterruptedException e ) {}
  -            
  -            update();
  -        }
  -    }
  -    
  -    /*---------------------------------------------------------------
        * Methods
        *-------------------------------------------------------------*/
       private void setTitle( ProfilableDescriptor profilableDescriptor,
  @@ -234,9 +213,6 @@
           getContentPane().add( m_lineChart );
           
           update();
  -        
  -        m_runner = new Thread( this, m_descriptor.getName() + "_sampleFrame" );
  -        m_runner.start();
       }
       
       void update()
  
  
  

--
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