code: public DBService getTenantDB(Tenant tenant) {
          synchronized (m_tenantDBMap) {
              DBService dbservice = m_tenantDBMap.get(tenant.getName());
              if (dbservice == null) {
                  dbservice = createTenantDBService(tenant);
                  m_tenantDBMap.put(tenant.getName(), dbservice);
              } else if (!sameTenantDefs(dbservice.getTenant().getDefinition(), tenant.getDefinition())) {
                  m_logger.info("Purging obsolete DBService for redefined tenant: {}", tenant.getName());
                  dbservice.stop();
                  dbservice = createTenantDBService(tenant);
                  m_tenantDBMap.put(tenant.getName(), dbservice);
              }
              return dbservice;
          }
      }
docs: Get the DBService for the given tenant. The DBService is created if necessary,
  causing it to connect to its underlying DB. An exception is thrown if the DB cannot
  be connected.
  
  @param tenant    {@link Tenant} to get DBService for.
  @return          {@link DBService} that manages data for that tenant.