com.arsdigita.developersupport
Class Counter

java.lang.Object
  extended bycom.arsdigita.developersupport.Counter

public final class Counter
extends Object

A debugging tool that helps you count how many times a particular action has been executed.

This API is subject to frequent change and should only be used for transient debugging sessions.

Set the "com.arsdigita.developersupport.Counter" log4j logger's level to DEBUG in order to see the collected stats.

Since:
2004-02-06
Version:
$DateTime: 2004/04/07 16:07:11 $ $Revision: #11 $
Author:
Vadim Nasardinov (vadimn@redhat.com)

Nested Class Summary
static class Counter.Context
           
static class Counter.ContextMismatchException
           
 
Method Summary
 void end(Counter.Context context)
           
static Counter getCounter()
           
 void increment(String action)
          Increments the running count of the action in the current context.
 void log(String message)
          Logs the passed in message and the current contents of the counter.
 Counter.Context start(String context)
          Creates a new counter context.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCounter

public static Counter getCounter()

start

public Counter.Context start(String context)
Creates a new counter context. Hold on to the returned value. You'll need it in order to end this context off the counter.


end

public void end(Counter.Context context)
Throws:
ContextMispatchException - if the passed in context does not match the current context of this counter.
NullPointerException - if expected is null

increment

public void increment(String action)
Increments the running count of the action in the current context.

Parameters:
action - the name of the action whose number of executions we are trying to compute.

log

public void log(String message)
Logs the passed in message and the current contents of the counter.


toString

public String toString()


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC