java.lang.Object
com.zeroc.IceMX.Observer<T>
- Type Parameters:
T
- the metrics type
- All Implemented Interfaces:
Observer
- Direct Known Subclasses:
ObserverWithDelegate
Observer implementation for metrics collection.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Interface for updating metrics objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
attach()
This method is called when the instrumented object is created or when the observer is attached to an existing object.long
delay()
Gets the current elapsed time without stopping the stopwatch.void
detach()
This method is called when the instrumented object is destroyed and as a result the observer detached from the object.void
Notification of a failure.void
Executes the specified update function on all metrics objects.getEntry
(com.zeroc.Ice.MetricsMap<?> map) Gets the metrics map entry for the specified map.getObserver
(String mapName, MetricsHelper<S> helper, Class<S> mcl, Class<ObserverImpl> ocl) Gets a sub-observer for the specified metrics type.void
init
(MetricsHelper<T> helper, List<com.zeroc.Ice.MetricsMap<T>.Entry> objects, Observer<T> previous) Initializes this observer with the specified parameters.boolean
Checks whether the stopwatch is currently running.void
start()
Starts the stopwatch.long
stop()
Stops the stopwatch and returns the elapsed time.
-
Constructor Details
-
Observer
public Observer()
-
-
Method Details
-
attach
public void attach()Description copied from interface:Observer
This method is called when the instrumented object is created or when the observer is attached to an existing object. -
detach
public void detach()Description copied from interface:Observer
This method is called when the instrumented object is destroyed and as a result the observer detached from the object. -
failed
Description copied from interface:Observer
Notification of a failure. -
forEach
Executes the specified update function on all metrics objects.- Parameters:
u
- the update function to execute
-
init
public void init(MetricsHelper<T> helper, List<com.zeroc.Ice.MetricsMap<T>.Entry> objects, Observer<T> previous) Initializes this observer with the specified parameters.- Parameters:
helper
- the metrics helperobjects
- the list of metrics map entriesprevious
- the previous observer, or null
-
getObserver
public <S extends Metrics,ObserverImpl extends Observer<S>> ObserverImpl getObserver(String mapName, MetricsHelper<S> helper, Class<S> mcl, Class<ObserverImpl> ocl) Gets a sub-observer for the specified metrics type.- Type Parameters:
S
- the sub-metrics typeObserverImpl
- the observer implementation type- Parameters:
mapName
- the name of the metrics maphelper
- the metrics helper for the sub-metrics typemcl
- the metrics classocl
- the observer class- Returns:
- the sub-observer, or null if no matching entries are found
-
getEntry
Gets the metrics map entry for the specified map.- Parameters:
map
- the metrics map to find- Returns:
- the matching entry, or null if not found
-
start
public void start()Starts the stopwatch. -
stop
public long stop()Stops the stopwatch and returns the elapsed time.- Returns:
- the elapsed time in microseconds
-
isStarted
public boolean isStarted()Checks whether the stopwatch is currently running.- Returns:
- true if the stopwatch is started, false otherwise
-
delay
public long delay()Gets the current elapsed time without stopping the stopwatch.- Returns:
- the elapsed time in microseconds since start was called
-