protected void checkMemory() {
boolean memoryLow = checkMemory(_memoryLowThreshold, false);
if(memoryLow != _isMemoryLow) {
if(!memoryLow) {
log.warn("App is no longer low on memory");
NSNotificationCenter.defaultCenter().postNotification(new NSNotification(LowMemoryResolvedNotification, this));
} else {
log.error("App is low on memory");
NSNotificationCenter.defaultCenter().postNotification(new NSNotification(LowMemoryNotification, this));
}
_isMemoryLow = memoryLow;
}
boolean memoryStarved = checkMemory(_memoryStarvedThreshold, true);
if(memoryStarved != _isMemoryStarved) {
if(!memoryStarved) {
log.warn("App is no longer starved, handling new sessions again");
NSNotificationCenter.defaultCenter().postNotification(new NSNotification(StarvedMemoryResolvedNotification, this));
} else {
log.error("App is starved, starting to refuse new sessions");
NSNotificationCenter.defaultCenter().postNotification(new NSNotification(StarvedMemoryNotification, this));
}
_isMemoryStarved = memoryStarved;
}
}