You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by le...@apache.org on 2004/07/22 10:23:54 UTC

svn commit: rev 23141 - excalibur/trunk/containerkit/instrument-manager/impl/src/java/org/apache/excalibur/instrument/manager

Author: leif
Date: Thu Jul 22 01:23:53 2004
New Revision: 23141

Modified:
   excalibur/trunk/containerkit/instrument-manager/impl/src/java/org/apache/excalibur/instrument/manager/AbstractInstrumentSample.java
Log:
Fix a problem where samples that had not been viewed or received any new values for some time were not being updated correctly before their state was saved.  This was making their hitory look incorrect when the state was later loaded.

Modified: excalibur/trunk/containerkit/instrument-manager/impl/src/java/org/apache/excalibur/instrument/manager/AbstractInstrumentSample.java
==============================================================================
--- excalibur/trunk/containerkit/instrument-manager/impl/src/java/org/apache/excalibur/instrument/manager/AbstractInstrumentSample.java	(original)
+++ excalibur/trunk/containerkit/instrument-manager/impl/src/java/org/apache/excalibur/instrument/manager/AbstractInstrumentSample.java	Thu Jul 22 01:23:53 2004
@@ -530,9 +530,19 @@
             return null;
         }
 
+        boolean update;
+        int value;
+        long time;
+
+        DefaultConfiguration state = new DefaultConfiguration( "sample", "-" );
         synchronized( this )
         {
-            DefaultConfiguration state = new DefaultConfiguration( "sample", "-" );
+            // Always update the sample so its state will be correct when saved.
+            long now = System.currentTimeMillis();
+            update = update( now );
+            value = getValueInner();
+            time = m_time;
+            
             state.setAttribute( "type",
                                 InstrumentSampleUtils.getInstrumentSampleTypeName( getType() ) );
             state.setAttribute( "interval", Long.toString( m_interval ) );
@@ -562,9 +572,14 @@
             state.addChild( samples );
 
             saveState( state );
+        }
 
-            return state;
+        if ( update )
+        {
+            updateListeners( value, time );
         }
+
+        return state;
     }
 
     /**

---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org