Interface IMonitorContext

  • All Known Subinterfaces:
    IMonitorContextSPI

    @StableMinor(version="14.2",
                 sinceVersion="9.0")
    public interface IMonitorContext
    Stores contextual data for use by the monitoring framework. The state of the monitor context applies to the current thread.

    The data is stored in the form of value providers, which are responsible for providing monitor data when required.

    Since:
    9.0.0
    Version:
    $Revision: 24985 $ $Date: 2022-05-02 23:04:30 -0300 (Mon, 02 May 2022) $
    See Also:
    IMonitorManager, IMonitorValuesProvider
    • Method Detail

      • getMonitoringValuesProviders

        List<IMonitorValuesProvider> getMonitoringValuesProviders()
        Returns a view of aggregation values stored in this monitor context.

        There is no guarantee whether the returned list will or will not reflect further changes made in this monitor context.

        Returns:
        an immutable list with the providers currently set in this monitor context.
        Since:
        9.0.0
      • addValues

        default IMonitorValuesProvider addValues​(String fieldId,
                                                 Serializable... values)
        Stores a monitoring value in this monitor context. removeValues(IMonitorValuesProvider) should be called (use a try/finally block to ensure that) to remove the aggregation value set when it should no longer be applied.

        Typical use for setting an aggregation value follows below:

         final String monitoringFieldId = ...;
         final Serializable value = ...;
         IMonitorValuesProvider provider = monitorContext.addValues(monitoringFieldId, value);
         try
         {
           // execution block that will have the set aggregation value as default
         }
         finally
         {
           monitorContext.removeValues(provider);
         }
         
        Parameters:
        fieldId - the field identifier.
        values - the values to set for the field.
        Returns:
        the created IMonitorValuesProvider to provide the given values.
        Since:
        9.0.0
      • addValues

        default IMonitorValuesProvider addValues​(String fieldId,
                                                 List<? extends Serializable> values)
        Stores a monitoring value in this monitor context. removeValues(IMonitorValuesProvider) should be called (use a try/finally block to ensure that) to remove the aggregation value set when it should no longer be applied.

        Typical use for setting an aggregation value follows below:

         final String monitoringFieldId = ...;
         final Serializable value = ...;
         IMonitorValuesProvider provider = monitorContext.addValues(monitoringFieldId, value);
         try
         {
           // execution block that will have the set aggregation value as default
         }
         finally
         {
           monitorContext.removeValues(provider);
         }
         
        Parameters:
        fieldId - the field identifier.
        values - the values to set for the field.
        Returns:
        the created IMonitorValuesProvider to provide the given values.
        Since:
        9.0.0
      • addValues

        default IMonitorValuesProvider addValues​(Map<String,​List<? extends Serializable>> fieldValues)
        Stores a monitoring value in this monitor context. removeValues(IMonitorValuesProvider) should be called (use a try/finally block to ensure that) to remove the aggregation value set when it should no longer be applied.

        Typical use for setting an aggregation value follows below:

         final String monitoringFieldId = ...;
         final Serializable value = ...;
         IMonitorValuesProvider provider = monitorContext.addValues(monitoringFieldId, value);
         try
         {
           // execution block that will have the set aggregation value as default
         }
         finally
         {
           monitorContext.removeValues(provider);
         }
         
        Parameters:
        fieldValues - the field values to set for the field.
        Returns:
        the created IMonitorValuesProvider to provide the given values.
        Since:
        9.0.0
      • addValues

        void addValues​(IMonitorValuesProvider... fieldValues)
        Stores a monitoring value in this monitor context. removeValues(IMonitorValuesProvider) should be called (use a try/finally block to ensure that) to remove the aggregation value set when it should no longer be applied.

        Typical use for setting an aggregation value follows below:

         IMonitorValuesProvider provider = new MyValueProvider();
         monitorContext.addValues(provider);
         try
         {
           // execution block that will have the set aggregation value as default
         }
         finally
         {
           monitorContext.removeValues(provider);
         }
         
        Parameters:
        fieldValues - the field values providers to set for the field.
        Since:
        9.0.0
      • clear

        void clear()
        Clears all data stored in the current monitor context.
        Since:
        9.0.0
      • isEnabled

        boolean isEnabled()
        Returns whether the current monitor context is enabled.
        Returns:
        whether the current monitor context is enabled.
        Since:
        11.0.0
      • isEmpty

        boolean isEmpty()
        Indicates whether this monitor context is empty.
        Returns:
        true if this monitor context is empty, false otherwise.
        Since:
        11.0.0