Class ToggleMonitors
- java.lang.Object
-
- com.adobe.granite.toggle.api.monitor.ToggleMonitors
-
@ProviderType public abstract class ToggleMonitors extends java.lang.Object
The ToggleMonitors class provides controlled and proper access for activating and deactivating aToggleMonitor
. Code that needs aToggleMonitor
should always get the instance from this class. Likewise, anyone implementing aToggleMonitor
should update this class to provide proper lifecycle management for the monitor.
-
-
Constructor Summary
Constructors Constructor Description ToggleMonitors()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ToggleMonitor
activateSystemPropertyToggleMonitor(ToggleMonitorManager toggleMonitorManager, java.lang.String toggleName, java.lang.String systemPropertyName)
Activate a newSystemPropertyToggleMonitor
for the providedsystemPropertyName
, and register it with the providedToggleMonitorManager
using the providedtoggleName
.static void
deactivateToggleMonitor(ToggleMonitorManager toggleMonitorManager, ToggleMonitor monitor, java.lang.String toggleName)
Deactivates aToggleMonitor
.
-
-
-
Method Detail
-
activateSystemPropertyToggleMonitor
public static ToggleMonitor activateSystemPropertyToggleMonitor(ToggleMonitorManager toggleMonitorManager, java.lang.String toggleName, java.lang.String systemPropertyName) throws java.lang.IllegalArgumentException
Activate a newSystemPropertyToggleMonitor
for the providedsystemPropertyName
, and register it with the providedToggleMonitorManager
using the providedtoggleName
. This call prevents a monitor from being associated with an existing Java system property. If the specifiedsystemPropertyName
is already a defined Java system property, the monitor will not be created or registered, andIllegalArgumentException
will be thrown.- Parameters:
toggleMonitorManager
- theToggleMonitorManager
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 providedToggleMonitorManager
is null, if the providedtoggleName
is null or an empty string, if the providedsystemPropertyName
is null or an empty string, or if there is already a Java system property in use matching the providedsystemPropertyName
.
-
deactivateToggleMonitor
public static void deactivateToggleMonitor(ToggleMonitorManager toggleMonitorManager, ToggleMonitor monitor, java.lang.String toggleName) throws java.lang.IllegalArgumentException
Deactivates aToggleMonitor
. Calling this method should deregister a monitor, and may also take care of any additional cleanup actions required for that monitor.- Parameters:
toggleMonitorManager
- theToggleMonitorManager
to use to deregister the providedToggleMonitor
.monitor
- theToggleMonitor
to deregister.toggleName
- the name of the feature toggle to deregister for.- Throws:
java.lang.IllegalArgumentException
- if the providedToggleMonitorManager
is null, if the providedToggleMonitor
is null, or if the providedtoggleName
is null or an empty string.
-
-