public class ListenerTimeMeasure extends SimplePullMeasure<Long> implements PullMeasure<Long>
MeasureListeners registered in PushMeasures. In order to
measure the time spent in a MeasureListener, you should wrap it by
calling wrapListener(MeasureListener). The wrapper returned should
be used instead of the original MeasureListener to allow the
ListenerTimeMeasure to account for its execution time. If you want to
wrap automatically all the MeasureListeners registered to a given
PushMeasure, you can wrap the PushMeasure through
wrapMeasure(PushMeasure): all the MeasureListeners
registered to the wrapper will be wrapped too. You can restart the evaluation
by calling reset().| Constructor and Description |
|---|
ListenerTimeMeasure() |
| Modifier and Type | Method and Description |
|---|---|
Long |
get() |
void |
reset()
This method reset the time measured to zero.
|
<Value> MeasureListener<Value> |
wrapListener(MeasureListener<Value> wrapped)
This method wrap a
MeasureListener (the wrapped) into another one
(the wrapper). |
<Value> MeasureManager |
wrapManager(MeasureManager wrapped,
Object measureKey)
This method wrap a
MeasureManager (the wrapped) into another one
(the wrapper) which provides the same measures, excepted that any
PushMeasure returned by the wrapper will be automatically wrapped
via wrapMeasure(PushMeasure). |
<Value> PushMeasure<Value> |
wrapMeasure(PushMeasure<Value> wrapped)
This method wrap a
PushMeasure (the wrapped) into another one
(the wrapper). |
getDescription, getName, setDescription, setName, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDescription, getNamepublic <Value> MeasureListener<Value> wrapListener(MeasureListener<Value> wrapped)
MeasureListener (the wrapped) into another one
(the wrapper). Any notification made via the wrapper will allow to
measure how much time has been spent by the wrapped to treat this
notification.PushMeasures that we don't want to consider. If a wrapper has
already been made for the given wrapped, it will be returned and no new
one will be instantiated (weak references are used to not keep in memory
the unused wrappers).wrapped - the MeasureListener to wrapMeasureListener wrapperpublic <Value> PushMeasure<Value> wrapMeasure(PushMeasure<Value> wrapped)
PushMeasure (the wrapped) into another one
(the wrapper). Any MeasureListener registered to the wrapper will
be automatically wrapped via wrapListener(MeasureListener). This
allows to ensure that any MeasureListener registered will be
considered, independently of who registers it or when it is registered.MeasureListeners that we don't want to consider. If a wrapper has
already been made for the given wrapped, it will be returned and no new
one will be instantiated (weak references are used to not keep in memory
the unused wrappers).wrapped - the PushMeasure to wrapPushMeasure wrapperpublic <Value> MeasureManager wrapManager(MeasureManager wrapped, Object measureKey)
MeasureManager (the wrapped) into another one
(the wrapper) which provides the same measures, excepted that any
PushMeasure returned by the wrapper will be automatically wrapped
via wrapMeasure(PushMeasure). This allows to ensure that any
MeasureListener registered to the PushMeasures provided
by the wrapper will be considered, independently of who registers it or
when it is registered. You can also provide an additional key to add this
ListenerTimeMeasure to the wrapper.MeasureListeners that we don't want to consider.wrapped - the MeasureManager to wrapmeasureKey - the key that the wrapper should use for this
ListenerTimeMeasure, null if it should
not use itMeasureManager wrapperpublic Long get()
get in interface PullMeasure<Long>MeasureListenerspublic void reset()
MeasureListeners which are still running will be affected
consequently: their execution time will be measured from the reset time,
not from their own starting time.Copyright © 2015. All rights reserved.