Class DefaultTimerFactory

  extended by org.e2etrace.timer.DefaultTimerFactory
All Implemented Interfaces:

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.

Gunther Popp

Constructor Summary
          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


public DefaultTimerFactory()
Default constructor.


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

timerType - type of timers the factory will return
Method Detail


public ITimer newInstance()
Creates a new timer instance.

Specified by:
newInstance in interface ITimerFactory
timer instance


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

timerType - New Timer type


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

Timer type

Copyright © 2013 Gunther Popp. All Rights Reserved.