Class ObserverFactory<T extends Metrics,O extends Observer<T>>

java.lang.Object
com.zeroc.IceMX.ObserverFactory<T,O>
Type Parameters:
T - the metrics type
O - the observer type
Direct Known Subclasses:
ObserverFactoryWithDelegate

public class ObserverFactory<T extends Metrics,O extends Observer<T>> extends Object
Factory for creating observer instances for metrics collection.
  • Constructor Details

    • ObserverFactory

      public ObserverFactory(com.zeroc.Ice.MetricsAdminI metrics, String name, Class<T> cl)
      Constructs an ObserverFactory.
      Parameters:
      metrics - the metrics admin instance
      name - the name of the metrics map
      cl - the metrics class
  • Method Details

    • destroy

      public void destroy()
      Destroys this observer factory and unregisters the metrics map.
    • getObserver

      public O getObserver(MetricsHelper<T> helper, Class<O> cl)
      Gets an observer instance for the specified helper.
      Parameters:
      helper - the metrics helper
      cl - the observer class
      Returns:
      the observer instance, or null if no metrics maps are enabled
    • getObserver

      public O getObserver(MetricsHelper<T> helper, Object observer, Class<O> cl)
      Gets an observer instance for the specified helper and previous observer.
      Parameters:
      helper - the metrics helper
      observer - the previous observer, or null
      cl - the observer class
      Returns:
      the observer instance, or null if no metrics maps are enabled
    • registerSubMap

      public <S extends Metrics> void registerSubMap(String subMap, Class<S> cl, Field field)
      Registers a sub-map for this observer factory.
      Type Parameters:
      S - the sub-metrics type
      Parameters:
      subMap - the name of the sub-map
      cl - the sub-metrics class
      field - 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

      public void setUpdater(Runnable updater)
      Sets an updater to be called when the factory is updated.
      Parameters:
      updater - the updater to call, or null