Module com.zeroc.ice
Package com.zeroc.IceMX
Class ObserverFactory<T extends Metrics,O extends Observer<T>>
java.lang.Object
com.zeroc.IceMX.ObserverFactory<T,O>
- Type Parameters:
T
- the metrics typeO
- the observer type
- Direct Known Subclasses:
ObserverFactoryWithDelegate
Factory for creating observer instances for metrics collection.
-
Constructor Summary
ConstructorsConstructorDescriptionObserverFactory
(com.zeroc.Ice.MetricsAdminI metrics, String name, Class<T> cl) Constructs an ObserverFactory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Destroys this observer factory and unregisters the metrics map.getObserver
(MetricsHelper<T> helper, Class<O> cl) Gets an observer instance for the specified helper.getObserver
(MetricsHelper<T> helper, Object observer, Class<O> cl) Gets an observer instance for the specified helper and previous observer.boolean
Checks whether this observer factory is enabled.<S extends Metrics>
voidregisterSubMap
(String subMap, Class<S> cl, Field field) Registers a sub-map for this observer factory.void
setUpdater
(Runnable updater) Sets an updater to be called when the factory is updated.void
update()
Updates the metrics maps and enabled state.
-
Constructor Details
-
ObserverFactory
Constructs an ObserverFactory.- Parameters:
metrics
- the metrics admin instancename
- the name of the metrics mapcl
- the metrics class
-
-
Method Details
-
destroy
public void destroy()Destroys this observer factory and unregisters the metrics map. -
getObserver
Gets an observer instance for the specified helper.- Parameters:
helper
- the metrics helpercl
- the observer class- Returns:
- the observer instance, or null if no metrics maps are enabled
-
getObserver
Gets an observer instance for the specified helper and previous observer.- Parameters:
helper
- the metrics helperobserver
- the previous observer, or nullcl
- the observer class- Returns:
- the observer instance, or null if no metrics maps are enabled
-
registerSubMap
Registers a sub-map for this observer factory.- Type Parameters:
S
- the sub-metrics type- Parameters:
subMap
- the name of the sub-mapcl
- the sub-metrics classfield
- the field to associate with the sub-map
-
isEnabled
public boolean isEnabled()Checks whether this observer factory is enabled.- Returns:
- true if enabled (has active metrics maps), false otherwise
-
update
public void update()Updates the metrics maps and enabled state. -
setUpdater
Sets an updater to be called when the factory is updated.- Parameters:
updater
- the updater to call, or null
-