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;
// boucherb@users 20040124 - patch 1.7.2
// Under the current contract, it's essentially impossible for an
// exception to get thrown here, because the database could not
// have been registered successfully before hand using the same
// path
//
// Eventually, we might think about storing the key with the
// database instance so as to avoid this unnecessary additional
// conversion and highly unlikely corner case handling.
try {
key = filePathToKey(path);
} catch (HsqlException e) {
Iterator it = databaseMap.keySet().iterator();
Object foundKey = null;
while (it.hasNext()) {
Object currentKey = it.next();
if (databaseMap.get(currentKey) == database) {
foundKey = currentKey;
break;
}
}
if (foundKey == null) {
// ??? return;
} else {
key = foundKey;
}
}
} else if (type == DatabaseURL.S_RES) {
databaseMap = resDatabaseMap;
} else if (type == DatabaseURL.S_MEM) {
databaseMap = memDatabaseMap;
} else {
throw (Trace.runtimeError(
Trace.UNSUPPORTED_INTERNAL_OPERATION,
"DatabaseManager.lookupDatabaseObject()"));
}
databaseIDMap.remove(dbID);
databaseMap.remove(key);
if (databaseIDMap.isEmpty()) {
ValuePool.resetPool();
}
}