Top Description Fields Constructors Methods
com.sun.faces.util

public Class Timer

extends Object
Class Inheritance
Static Imports
java.util.logging.Level.FINE

This class is a simple wrapper for timing method calls. The traditional method is to add two variables, start, and stop, and display the difference of these values. Encapsulates the process.

Field Summary

Modifier and TypeField and Description
private static final Logger
private final Level
private long
private long

Constructor Summary

AccessConstructor and Description
private
Timer(final Level logLevel)

Method Summary

Modifier and TypeMethod and Description
public static Timer

Returns:

a new Timer instance if the TIMING logging level is FINE, otherwise, return null;
getInstance
()

public static Timer
getInstance(Level logLevel)

private long

Returns:

the time for this task
getTimingResult
()

public void
logResult(String
task description
taskInfo
)

Log the timing result.

public void
startTiming()

Start timing.

public void
stopTiming()

Stop timing.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
logLevelback to summary
private final Level logLevel
startback to summary
private long start
stopback to summary
private long stop

Constructor Detail

Timerback to summary
private Timer(final Level logLevel)

Method Detail

getInstanceback to summary
public static Timer getInstance()
Returns:Timer

a new Timer instance if the TIMING logging level is FINE, otherwise, return null;

getInstanceback to summary
public static Timer getInstance(Level logLevel)
getTimingResultback to summary
private long getTimingResult()
Returns:long

the time for this task

logResultback to summary
public void logResult(String taskInfo)

Log the timing result.

Parameters
taskInfo:String

task description

startTimingback to summary
public void startTiming()

Start timing.

stopTimingback to summary
public void stopTiming()

Stop timing.