org.e2etrace.timer
Class DefaultTimerFactory

java.lang.Object
  extended by org.e2etrace.timer.DefaultTimerFactory
All Implemented Interfaces:
ITimerFactory

public class DefaultTimerFactory
extends Object
implements ITimerFactory

Default Factory class for Timer instances.

The factory returns a new Timer instance. In the default configuration, the new Timer is of the type DefaultTimer. Please refer to the documentation of this class to learn about the restrictions of the underlying implementation.

However, if e2etrace has been compiled and is executed using JDK 5.0 (or higher), the factory will return instances of the type ExactTimer. This Timer implementation uses the advanced timing features of the new JDK releases and avoids all problems described in the documentation of DefaultTimer.

Please note the different constructors of the factory. You can force the factory to create specific types of Timers by using the appropriate constructor. If you use the default constructor, the above described logic applies.

You can use the class PrintTimerAccuracy to determine which Timer type will be used by e2etrace on your system and which accuracy the Timers are able to deliver.

Author:
Gunther Popp

Constructor Summary
DefaultTimerFactory()
          Default constructor.
DefaultTimerFactory(Class timerType)
          Constructor using a pre-defined Timer type.
 
Method Summary
 Class getTimerType()
          Returns the type of Timers currently used by the Factory.
 ITimer newInstance()
          Creates a new timer instance.
 void setTimerType(Class timerType)
          Changes the type of Timer returned by the Factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTimerFactory

public DefaultTimerFactory()
Default constructor.


DefaultTimerFactory

public DefaultTimerFactory(Class timerType)
Constructor using a pre-defined Timer type.

Parameters:
timerType - type of timers the factory will return
Method Detail

newInstance

public ITimer newInstance()
Creates a new timer instance.

Specified by:
newInstance in interface ITimerFactory
Returns:
timer instance

setTimerType

public void setTimerType(Class timerType)
Changes the type of Timer returned by the Factory.

Parameters:
timerType - New Timer type

getTimerType

public Class getTimerType()
Returns the type of Timers currently used by the Factory.

Returns:
Timer type


Copyright © 2013 Gunther Popp. All Rights Reserved.