org.hd.d.efs
Class Utils

java.lang.Object
  extended by org.hd.d.efs.Utils

public final class Utils
extends java.lang.Object

Utility routines, eg for memory and threading.


Nested Class Summary
static class Utils.SimpleLRUMapAutoSizeForHitRate<K,V>
          Simplified map with fixed capacity that discards excess items in LRU (Least Recently Used) order to meet a hit/miss ratio goal.
 
Method Summary
static boolean isMemoryStressed()
          Returns true if the memory system may be under stress, eg not enough free.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isMemoryStressed

public static final boolean isMemoryStressed()
Returns true if the memory system may be under stress, eg not enough free. This may work best if polled reasonably regularly.

This is likely to be at best stochastic, ie more likely to return true under severe memory stress, and less likely to return true when not under significant memory stress.

This checks the clearing of a SoftReference as one measure of memory stress:

TODO: make use of MemoryPoolMXBean (etc) facilities for more robust detection.