Package org.opennms.netmgt.threshd
Class BlobStoreAwareMonitor
- java.lang.Object
-
- org.opennms.netmgt.threshd.BlobStoreAwareMonitor
-
- All Implemented Interfaces:
ThresholdStateMonitor
public class BlobStoreAwareMonitor extends Object implements ThresholdStateMonitor
This implementation tracks the in-memory states of thresholds while also being aware of their persistence. This allows for the encapsulation of atomic clear/reinitialize logic where both the in-memory and persisted copies of the state can be cleared together without clients of being aware.
-
-
Constructor Summary
Constructors Constructor Description BlobStoreAwareMonitor(BlobStore blobStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
reinitializeState(String stateKey)
Reinitialize a single state identified by the given key.void
reinitializeStates()
Reinitialize all states currently tracked by this monitor.void
trackState(String key, ReinitializableState state)
Track the given state identified by the given key.void
withReadLock(Runnable r)
Run some arbitrary code while holding the lock to the state monitor.
-
-
-
Constructor Detail
-
BlobStoreAwareMonitor
public BlobStoreAwareMonitor(BlobStore blobStore)
-
-
Method Detail
-
trackState
public void trackState(String key, ReinitializableState state)
Description copied from interface:ThresholdStateMonitor
Track the given state identified by the given key.- Specified by:
trackState
in interfaceThresholdStateMonitor
-
withReadLock
public void withReadLock(Runnable r)
Description copied from interface:ThresholdStateMonitor
Run some arbitrary code while holding the lock to the state monitor. This is used to block reinitialization while the givencode
is running.- Specified by:
withReadLock
in interfaceThresholdStateMonitor
-
reinitializeState
public void reinitializeState(String stateKey)
Description copied from interface:ThresholdStateMonitor
Reinitialize a single state identified by the given key.- Specified by:
reinitializeState
in interfaceThresholdStateMonitor
-
reinitializeStates
public void reinitializeStates()
Description copied from interface:ThresholdStateMonitor
Reinitialize all states currently tracked by this monitor.- Specified by:
reinitializeStates
in interfaceThresholdStateMonitor
-
-