Class ToggleMonitors


  • @ProviderType
    public abstract class ToggleMonitors
    extends java.lang.Object
    The ToggleMonitors class provides controlled and proper access for activating and deactivating a ToggleMonitor. Code that needs a ToggleMonitor should always get the instance from this class. Likewise, anyone implementing a ToggleMonitor should update this class to provide proper lifecycle management for the monitor.
    • Constructor Detail

      • ToggleMonitors

        public ToggleMonitors()
    • Method Detail

      • activateSystemPropertyToggleMonitor

        public static ToggleMonitor activateSystemPropertyToggleMonitor​(ToggleMonitorManager toggleMonitorManager,
                                                                        java.lang.String toggleName,
                                                                        java.lang.String systemPropertyName)
                                                                 throws java.lang.IllegalArgumentException
        Activate a new SystemPropertyToggleMonitor for the provided systemPropertyName, and register it with the provided ToggleMonitorManager using the provided toggleName. This call prevents a monitor from being associated with an existing Java system property. If the specified systemPropertyName is already a defined Java system property, the monitor will not be created or registered, and IllegalArgumentException will be thrown.
        Parameters:
        toggleMonitorManager - the ToggleMonitorManager instance with which to register the resulting monitor.
        toggleName - the feature toggle name for the created monitor.
        systemPropertyName - the Java system property the created monitor will manage.
        Returns:
        the created ToggleMonitor.
        Throws:
        java.lang.IllegalArgumentException - if the provided ToggleMonitorManager is null, if the provided toggleName is null or an empty string, if the provided systemPropertyName is null or an empty string, or if there is already a Java system property in use matching the provided systemPropertyName.
      • deactivateToggleMonitor

        public static void deactivateToggleMonitor​(ToggleMonitorManager toggleMonitorManager,
                                                   ToggleMonitor monitor,
                                                   java.lang.String toggleName)
                                            throws java.lang.IllegalArgumentException
        Deactivates a ToggleMonitor. Calling this method should deregister a monitor, and may also take care of any additional cleanup actions required for that monitor.
        Parameters:
        toggleMonitorManager - the ToggleMonitorManager to use to deregister the provided ToggleMonitor.
        monitor - the ToggleMonitor to deregister.
        toggleName - the name of the feature toggle to deregister for.
        Throws:
        java.lang.IllegalArgumentException - if the provided ToggleMonitorManager is null, if the provided ToggleMonitor is null, or if the provided toggleName is null or an empty string.