You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/04/22 11:52:42 UTC
cvs commit: jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument CounterInstrument.java InstrumentProxy.java
leif 02/04/22 02:52:42
Modified: instrument/src/java/org/apache/avalon/excalibur/instrument
CounterInstrument.java InstrumentProxy.java
Log:
Add the ability to increment by more than 1 on CounterInstruments.
Revision Changes Path
1.4 +18 -2 jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument/CounterInstrument.java
Index: CounterInstrument.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument/CounterInstrument.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CounterInstrument.java 3 Apr 2002 13:48:49 -0000 1.3
+++ CounterInstrument.java 22 Apr 2002 09:52:42 -0000 1.4
@@ -14,7 +14,7 @@
* times that a method is accessed.
*
* @author <a href="mailto:leif@tanukisoftware.com">Leif Mortenson</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/04/03 13:48:49 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/04/22 09:52:42 $
* @since 4.1
*/
public class CounterInstrument
@@ -47,7 +47,23 @@
InstrumentProxy proxy = getInstrumentProxy();
if ( proxy != null )
{
- proxy.increment();
+ proxy.increment( 1 );
+ }
+ }
+
+ /**
+ * Increments the Instrument by a specified count. This method is
+ * optimized to be extremely light weight when an InstrumentManager is not
+ * present and there are no registered CounterInstrumentListeners.
+ *
+ * @param count A positive integer to increment the counter by.
+ */
+ public void increment( int count )
+ {
+ InstrumentProxy proxy = getInstrumentProxy();
+ if ( proxy != null )
+ {
+ proxy.increment( count );
}
}
}
1.4 +7 -4 jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument/InstrumentProxy.java
Index: InstrumentProxy.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/instrument/src/java/org/apache/avalon/excalibur/instrument/InstrumentProxy.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- InstrumentProxy.java 3 Apr 2002 13:48:49 -0000 1.3
+++ InstrumentProxy.java 22 Apr 2002 09:52:42 -0000 1.4
@@ -18,7 +18,7 @@
* as an instrument used by the instrument manager.
*
* @author <a href="mailto:leif@tanukisoftware.com">Leif Mortenson</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/04/03 13:48:49 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/04/22 09:52:42 $
* @since 4.1
*/
public interface InstrumentProxy
@@ -32,13 +32,16 @@
boolean isActive();
/**
- * Increments the Instrument. This method should be optimized to be extremely
- * light weight when there are no registered CounterInstrumentListeners.
+ * Increments the Instrument by a specified count. This method should be
+ * optimized to be extremely light weight when there are no registered
+ * CounterInstrumentListeners.
* <p>
* This method may throw an IllegalStateException if the proxy is not meant
* to handle calls to increment.
+ *
+ * @param count A positive integer to increment the counter by.
*/
- void increment();
+ void increment( int count );
/**
* Sets the current value of the Instrument. This method is optimized
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>