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/instrument-manager/src/java/org/apache/excalibur/instrument/manager InstrumentProxy.java
Date Tue, 20 Aug 2002 03:27:13 GMT
leif        2002/08/19 20:27:12

  Modified:    instrument-manager/src/java/org/apache/excalibur/instrument/manager
                        InstrumentProxy.java
  Log:
  Make the ValueInstruments inform newly registered listeners of their last know
  value when they register.  This makes it possible to see the current size of pools
  etc.  Before they would not be known until the next time setValue was called.
  
  Revision  Changes    Path
  1.2       +13 -1     jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentProxy.java
  
  Index: InstrumentProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InstrumentProxy.java	14 Aug 2002 14:58:21 -0000	1.1
  +++ InstrumentProxy.java	20 Aug 2002 03:27:12 -0000	1.2
  @@ -77,6 +77,9 @@
       /** Child logger to use for logging of new values. */
       private Logger m_valueLogger;
       
  +    /** The most recent value set if this is a value instrument. */
  +    private int m_lastValue;
  +    
       /*---------------------------------------------------------------
        * Constructors
        *-------------------------------------------------------------*/
  @@ -248,6 +251,11 @@
                   "The proxy is not configured to handle ValueInstruments." );
           }
           
  +        // Store the most recent value so that new listeners can be informed
  +        //  of the current value when they register.  ints are single memory
  +        //  locations, so synchronization is not needed here.
  +        m_lastValue = value;
  +        
           // Get a local reference to the listeners, so that synchronization can be avoided.
           InstrumentListener[] listeners = m_listeners;
           if ( listeners != null )
  @@ -473,6 +481,10 @@
           }
           
           addInstrumentListener( listener );
  +        
  +        // Inform the new listener of the current value
  +        long time = System.currentTimeMillis();
  +        listener.setValue( getName(), m_lastValue, time );
       }
       
       /**
  
  
  

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