code: protected synchronized void registerOpenDatabase(DatabaseImpl newDB)
      {
          DatabaseImpl old_db = getCurrentDatabase();
          if (old_db != null)
          {
              try
              {
                  if (old_db.isOpen())
                  {
                      log.warn("## There is still an opened database, close old one ##");
                      old_db.close();
                  }
              }
              catch (Throwable t)
              {
                  //ignore
              }
          }
          if (log.isDebugEnabled()) log.debug("Set current database " + newDB + " PBKey was " + newDB.getPBKey());
          setCurrentDatabase(newDB);
  //        usedDatabases.add(newDB.getPBKey());
      }
docs: Register opened database via the PBKey.