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 interfaceInterface for updating metrics objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattach()This method is called when the instrumented object is created or when the observer is attached to an existing object.longdelay()Gets the current elapsed time without stopping the stopwatch.voiddetach()This method is called when the instrumented object is destroyed and as a result the observer detached from the object.voidNotifies the observer of a failure.voidExecutes 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.voidinit(MetricsHelper<T> helper, List<com.zeroc.Ice.MetricsMap<T>.Entry> objects, Observer<T> previous) Initializes this observer with the specified parameters.booleanChecks whether the stopwatch is currently running.voidstart()Starts the stopwatch.longstop()Stops the stopwatch and returns the elapsed time.
-
Constructor Details
-
Observer
public Observer()
-
-
Method Details
-
attach
public void attach()Description copied from interface:ObserverThis 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:ObserverThis method is called when the instrumented object is destroyed and as a result the observer detached from the object. -
failed
Description copied from interface:ObserverNotifies the observer 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
-