_unknownAppLock.startWriting();
try {
NSMutableDictionary unknownApps = _unknownApplications;
// Should make this configurable?
NSTimestamp cutOffDate = new NSTimestamp(System.currentTimeMillis() - 45000);
NSArray unknownAppKeys = unknownApps.allKeys();
for (Enumeration e = unknownAppKeys.objectEnumerator(); e.hasMoreElements(); ) {
String unknownAppKey = (String) e.nextElement();
NSMutableDictionary appDict = (NSMutableDictionary) unknownApps.valueForKey(unknownAppKey);
if (appDict != null) {
NSArray appDictKeys = appDict.allKeys();
for (Enumeration e2 = appDictKeys.objectEnumerator(); e2.hasMoreElements(); ) {
String appDictKey = (String) e2.nextElement();
NSTimestamp lastLifebeat = (NSTimestamp) appDict.valueForKey(appDictKey);
if ( (lastLifebeat != null) && (lastLifebeat.before(cutOffDate)) ) {
appDict.removeObjectForKey(appDictKey);
}
}
if (appDict.count() == 0) {
unknownApps.removeObjectForKey(unknownAppKey);