1 50 package org.apache.excalibur.instrument; 51 52 62 public class CounterInstrument 63 extends AbstractInstrument 64 { 65 68 74 public CounterInstrument( String name ) 75 { 76 super( name ); 77 } 78 79 82 87 public void increment() 88 { 89 InstrumentProxy proxy = getInstrumentProxy(); 90 if( proxy != null ) 91 { 92 proxy.increment( 1 ); 93 } 94 } 95 96 105 public void increment( int count ) 106 { 107 if( count <= 0 ) 109 { 110 throw new IllegalArgumentException ( "Count must be a positive value." ); 111 } 112 113 InstrumentProxy proxy = getInstrumentProxy(); 114 if( proxy != null ) 115 { 116 proxy.increment( count ); 117 } 118 } 119 } 120 | Popular Tags |