public class LowMemory extends java.lang.Object
Expected usage is one instance of this class per major logical
operation, e.g. creating a connection, preparing a statement,
adding an entry to a specific cache etc.
The logical operation would call isLowMemory() before starting the operation, and thrown a static exception if it returns true.
If during the operation an OutOfMemoryException is thrown the operation would call setLowMemory() and throw its static exception representing low memory.
Future enhancments could be a callback mechanism for modules where they register they can reduce memory usage on a low memory situation. These callbacks would be triggered by a call to setLowMemory. For example the page cache could reduce its current size by 10% in a low memory situation.
|Constructor and Description|
|Modifier and Type||Method and Description|
Return true if a low memory water mark has been set and the current free memory is lower than it.
Set a low memory watermark where the owner of this object just hit an OutOfMemoryError.
public void setLowMemory()
public boolean isLowMemory()