|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.engine.impl.request.SlingRequestProgressTracker
public class SlingRequestProgressTracker
The SlingRequestProgressTracker
class provides the
functionality to track the progress of request processing. Instances of this
class are provided through the
SlingHttpServletRequest.getRequestProgressTracker()
method.
The following functionality is provided:
log(String)
and log(String, Object...)
methods.
startTimer(String)
and
logTimer(String)
methods.
dump(PrintWriter)
method.
reset()
method.
Tracking Request Processing
As the request being processed, certain steps may be tracked by calling
either of the log
methods. A tracking entry consists of a time
stamp managed by this class, and a tracking message noting the actual step being
tracked.
Timing Processing Steps
Certain steps during request processing may need to be timed in that the time required for processing should be recorded. Instances of this class maintain a map of named timers. Each timer is started (initialized or reset) by calling thestartTimer(String)
method. This method just records the
starting time of the named timer.
To record the number of milliseconds ellapsed since a timer has been started,
the logTimer(String)
method may be called. This method logs the
tracking entry with message
consisting of the name of the timer and the number of milliseconds ellapsed
since the timer was last started
. The
logTimer(String)
method may be called multiple times to record
several timed steps.
Additional information can be logged using the logTimer(String, String, Object...)
method.
Calling the startTimer(String)
method with the name of timer which
already exists, resets the start time of the named timer to the current
system time.
Dumping Tracking Entries
The dump(PrintWriter)
methods writes all tracking entries to the given
PrintWriter
. Each entry is written on a single line
consisting of the following fields:
reset()
(or creation)
of this timer.
Constructor Summary | |
---|---|
SlingRequestProgressTracker()
Creates a new request progress tracker. |
Method Summary | |
---|---|
void |
done()
Call this when done processing the request - all calls except the first one are ignored |
void |
dump(PrintWriter writer)
Dumps the process timer entries to the given writer, one entry per line. |
Iterator<String> |
getMessages()
Returns an Iterator of tracking entries. |
void |
log(String message)
Creates an entry with the given message. |
void |
log(String format,
Object... args)
Creates an entry with the given entry tag and message |
void |
logTimer(String name)
Log a timer entry, including start, end and elapsed time. |
void |
logTimer(String name,
String format,
Object... args)
Log a timer entry, including start, end and elapsed time. |
void |
reset()
Resets this timer by removing all current entries and timers and adds an initial timer entry |
void |
startTimer(String name)
Starts a named timer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SlingRequestProgressTracker()
Method Detail |
---|
public void reset()
public Iterator<String> getMessages()
RequestProgressTracker
Iterator
of tracking entries.
If there are no messages null
is returned.
getMessages
in interface RequestProgressTracker
RequestProgressTracker.getMessages()
public void dump(PrintWriter writer)
dump
in interface RequestProgressTracker
public void log(String message)
log
in interface RequestProgressTracker
public void log(String format, Object... args)
log
in interface RequestProgressTracker
public void startTimer(String name)
startTimer
in interface RequestProgressTracker
public void logTimer(String name)
logTimer
in interface RequestProgressTracker
public void logTimer(String name, String format, Object... args)
logTimer
in interface RequestProgressTracker
public void done()
RequestProgressTracker
done
in interface RequestProgressTracker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |