int dbID = database.databaseID;
String type = database.getType();
String path = database.getPath();
Object key = path;
HashMap databaseMap;
notifyServers(database);
if (type == DatabaseURL.S_FILE) {
databaseMap = fileDatabaseMap;
key = filePathToKey(path);
} else if (type == DatabaseURL.S_RES) {
databaseMap = resDatabaseMap;
} else if (type == DatabaseURL.S_MEM) {
databaseMap = memDatabaseMap;
} else {
throw (Error.runtimeError(ErrorCode.U_S0500, "DatabaseManager"));
}
boolean isEmpty = false;
synchronized (databaseIDMap) {
databaseIDMap.remove(dbID);
isEmpty = databaseIDMap.isEmpty();
}
synchronized (databaseMap) {
databaseMap.remove(key);
}
if (isEmpty) {
ValuePool.resetPool();
}