1 19 20 package org.apache.excalibur.instrument.manager.impl; 21 22 import org.apache.avalon.framework.configuration.Configuration; 23 import org.apache.avalon.framework.configuration.ConfigurationException; 24 import org.apache.avalon.framework.configuration.DefaultConfiguration; 25 26 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 27 28 34 class MaximumValueInstrumentSample 35 extends AbstractValueInstrumentSample 36 { 37 40 51 MaximumValueInstrumentSample( InstrumentProxy instrumentProxy, 52 String name, 53 long interval, 54 int size, 55 String description, 56 long lease ) 57 { 58 super( instrumentProxy, name, interval, size, description, lease ); 59 } 60 61 64 69 public int getType() 70 { 71 return DefaultInstrumentManager.INSTRUMENT_SAMPLE_TYPE_MAXIMUM; 72 } 73 74 77 84 protected void setValueInner( int value, long time ) 85 { 86 boolean update; 87 int sampleValue; 88 long sampleTime; 89 90 synchronized(this) 91 { 92 update = update( time, false ); 93 94 m_lastValue = value; 96 97 if ( m_valueCount > 0 ) 98 { 99 m_valueCount++; 101 if ( value > m_value ) 102 { 103 m_value = value; 104 update = true; 105 } 106 } 107 else 108 { 109 m_valueCount = 1; 111 m_value = value; 112 update = true; 113 } 114 115 sampleValue = m_value; 116 sampleTime = m_time; 117 } 118 119 if ( update ) 120 { 121 updateListeners( sampleValue, sampleTime ); 122 } 123 } 124 } 125 | Popular Tags |