private boolean isRunningOutOfMemory ( ) { StorageLevel level = raft . getStorage ( ) . storageLevel ( ) ; if ( level == StorageLevel . MEMORY || level == StorageLevel . MAPPED ) { long freeMemory = raft . getStorage ( ) . statistics ( ) . getFreeMemory ( ) ; long totalMemory = raft . getStorage ( ) . statistics ( ) . getTotalMemory ( ) ; if ( freeMemory > 0 && totalMemory > 0 ) { return freeMemory / ( double ) totalMemory < raft . getStorage ( ) . freeMemoryBuffer ( ) ; } } return false ; }
Returns a boolean indicating whether the node is running out of memory .