Package org.glassfish.pfl.tf.timer.spi
Class TimerManager<T>
- java.lang.Object
-
- org.glassfish.pfl.tf.timer.spi.TimerManager<T>
-
public class TimerManager<T> extends java.lang.Object
Provides access to timer facilities. This is intended to make it easy to set up timing, either for performance tests, or for adaptive policy management. Note that the constructor and the initialize method must be called from the same thread in order to safely complete the initialization of an instance of this class. After that, multiple threads may access this class for the factory(), points(), and controller() methods.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Class<?>,java.util.List<Timer>>
classToTimers
private TimerEventController
controller
private boolean
isInitialized
private TimerFactory
tf
private T
tp
-
Constructor Summary
Constructors Constructor Description TimerManager(java.lang.String name)
TimerManager(ObjectRegistrationManager orm, java.lang.String name)
Create a new TimerManager, with a TimerFactory registered under the given name in the TimerFactoryBuilder, and a TimerEventController with the same name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkInitialized()
TimerEventController
controller()
Return a TimerController.void
destroy()
Destroy this TimerManager by removing its TimerFactory from the TimerFactoryBuilder.TimerFactory
factory()
Get the TimerFactory.java.util.List<Timer>
getTimers(java.lang.Class<?> cls)
void
initialize(T tp)
T
points()
Get the timing point utility class of type T.
-
-
-
Field Detail
-
tf
private final TimerFactory tf
-
controller
private final TimerEventController controller
-
tp
private volatile T tp
-
isInitialized
private volatile boolean isInitialized
-
classToTimers
private final java.util.Map<java.lang.Class<?>,java.util.List<Timer>> classToTimers
-
-
Constructor Detail
-
TimerManager
public TimerManager(ObjectRegistrationManager orm, java.lang.String name)
Create a new TimerManager, with a TimerFactory registered under the given name in the TimerFactoryBuilder, and a TimerEventController with the same name.
-
TimerManager
public TimerManager(java.lang.String name)
-
-
Method Detail
-
destroy
public void destroy()
Destroy this TimerManager by removing its TimerFactory from the TimerFactoryBuilder.
-
checkInitialized
private void checkInitialized()
-
initialize
public void initialize(T tp)
-
points
public T points()
Get the timing point utility class of type T.
-
factory
public TimerFactory factory()
Get the TimerFactory.
-
controller
public TimerEventController controller()
Return a TimerController. Returns null if called before initialize( T ).
-
getTimers
public java.util.List<Timer> getTimers(java.lang.Class<?> cls)
-
-