Class MemoryMonitoring

java.lang.Object
nz.org.riskscape.engine.MemoryMonitoring

public class MemoryMonitoring extends Object

A Gauge returning a string indicating whether memory usage is within a certain band = a PoC to see whether we can detect low memory situations reliable

NB - tends to report false low memory situations, as the standard saw tooth behaviour of the jvm's memory use will trip the gauge, even though a GC will reclaim the memory. Hard to know if this matters, but if code just uses this gauge to manage caches, it's probably fine. Maybe see about using the technique in http://www.fasterj.com/articles/gcnotifs.shtml

  • Field Details

  • Constructor Details

    • MemoryMonitoring

      public MemoryMonitoring()
  • Method Details

    • formatBytes

      protected static String formatBytes(long numBytes)
    • getCurrentHeapFreeLevel

      public com.codahale.metrics.Gauge<MemoryMonitoring.Level> getCurrentHeapFreeLevel()
    • getPostFullGCHeapFreeLevel

      public com.codahale.metrics.Gauge<MemoryMonitoring.Level> getPostFullGCHeapFreeLevel()