Package com.nuix.superutilities.misc
Class FreeSpaceMonitor
- java.lang.Object
-
- com.nuix.superutilities.misc.FreeSpaceMonitor
-
public class FreeSpaceMonitor extends java.lang.Object
Provides a way to monitor file system locations and act when available disk space drops below a specified threshold.
-
-
Constructor Summary
Constructors Constructor Description FreeSpaceMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMonitoredLocation(java.lang.String pathString, double freeSpaceThresholdGb)
Adds a location to be monitoredvoid
beginMonitoring()
Begins monitoring locations by polling them at intervals.void
shutdownMonitoring()
Signals to polling thread that it should wind down and stop polling the monitored locations.void
whenErrorOccurs(FreeSpaceMonitorEventCallback callback)
Allows you to register a call which will be invoked when a monitoring error occurs.void
whenFreeSpaceBelowThreshold(FreeSpaceMonitorEventCallback callback)
Allows you to register a callback which will be invoked when a monitored location is found to dip below the free space threshold.void
whenFreeSpaceIssueResolved(FreeSpaceMonitorEventCallback callback)
Allows you to register a callback which will be invoked when a monitored location which previously was below a free space threshold is no longer below that threshold.
-
-
-
Method Detail
-
addMonitoredLocation
public void addMonitoredLocation(java.lang.String pathString, double freeSpaceThresholdGb)
Adds a location to be monitored- Parameters:
pathString
- Path string to the location to be monitoredfreeSpaceThresholdGb
- Free space threshold to begin reacting to
-
whenFreeSpaceBelowThreshold
public void whenFreeSpaceBelowThreshold(FreeSpaceMonitorEventCallback callback)
Allows you to register a callback which will be invoked when a monitored location is found to dip below the free space threshold.- Parameters:
callback
- The callback to be invoked
-
whenFreeSpaceIssueResolved
public void whenFreeSpaceIssueResolved(FreeSpaceMonitorEventCallback callback)
Allows you to register a callback which will be invoked when a monitored location which previously was below a free space threshold is no longer below that threshold.- Parameters:
callback
- The callback to be invoked
-
whenErrorOccurs
public void whenErrorOccurs(FreeSpaceMonitorEventCallback callback)
Allows you to register a call which will be invoked when a monitoring error occurs.- Parameters:
callback
- The callback to be invoked
-
beginMonitoring
public void beginMonitoring()
Begins monitoring locations by polling them at intervals. Should later be followed by a call toshutdownMonitoring()
once monitoring is no longer needed.
-
shutdownMonitoring
public void shutdownMonitoring()
Signals to polling thread that it should wind down and stop polling the monitored locations. See methodbeginMonitoring()
for how to begin monitoring.
-
-