1 7 package com.sun.corba.se.spi.monitoring; 8 9 import java.util.*; 10 11 22 public class StatisticMonitoredAttribute extends MonitoredAttributeBase { 23 24 25 private StatisticsAccumulator statisticsAccumulator; 29 30 private Object mutex; 33 34 35 38 39 67 public StatisticMonitoredAttribute(String name, String desc, 68 StatisticsAccumulator s, Object mutex) 69 { 70 super( name ); 71 MonitoredAttributeInfoFactory f = 72 MonitoringFactories.getMonitoredAttributeInfoFactory(); 73 MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo( 74 desc, String .class, false, true ); 75 76 this.setMonitoredAttributeInfo( maInfo ); 77 this.statisticsAccumulator = s; 78 this.mutex = mutex; 79 } 81 82 83 88 public Object getValue( ) { 89 synchronized( mutex ) { 90 return statisticsAccumulator.getValue( ); 91 } 92 } 93 94 98 public void clearState( ) { 99 synchronized( mutex ) { 100 statisticsAccumulator.clearState( ); 101 } 102 } 103 104 109 public StatisticsAccumulator getStatisticsAccumulator( ) { 110 return statisticsAccumulator; 111 } 112 } 114 115 116 | Popular Tags |